Commit graph

573 commits

Author SHA1 Message Date
Tomas Winkler 4b9960d052 mei: constify buffer in the write functions calls
The write buffer should not by modified so make it constant. Also
hitchhike some style fixes on the way in the interface and rename
mei_me_write_message to mei_me_hbuf_write for consistency.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-15 10:56:52 +01:00
Tomas Winkler 17ba8a08b5 mei: consolidate repeating code in mei_cl_irq_read_msg
A cb is always placed on the completion queue
during discarding queue. Hence this can be performed
upon discard.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-15 10:56:52 +01:00
Greg Kroah-Hartman b7d91c9152 Merge 4.9-rc5 into char-misc-next
We want those fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-14 16:39:47 +01:00
Alexander Usyskin 7279b238ba mei: send OS type to the FW
Tell the FW that we are running a sane OS and TPM2_ChangeEPS()
is supported. This workaround was added to support other broken OS
and we need to follow here. The command is sent just once at the boot time.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-10 16:52:09 +01:00
Alexander Usyskin e0cb6b2f87 mei: enable to set the internal flag for client write
Prepare the client write functions to set the internal flag in message
header. Carry both blocking and internal modes inside the transmit cb,
and call internal bus function  __mei_cl_send() with send mode bit mask.
The Internal flag should be added only on messages generated by the
driver.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-10 13:18:02 +01:00
Alexander Usyskin 582ab27a06 mei: bus: fix received data size check in NFC fixup
NFC version reply size checked against only header size, not against
full message size. That may lead potentially to uninitialized memory access
in version data.

That leads to warnings when version data is accessed:
drivers/misc/mei/bus-fixup.c: warning: '*((void *)&ver+11)' may be used uninitialized in this function [-Wuninitialized]:  => 212:2

Reported in
Build regressions/improvements in v4.9-rc3
https://lkml.org/lkml/2016/10/30/57

Fixes: 59fcd7c63a (mei: nfc: Initial nfc implementation)
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-31 10:25:22 -06:00
Alexander Usyskin d882039e76 mei: bus: demote error to debug level upon disconnect
A mei client driver on the mei client bus can call disconnect function on
already internal disconnected client.  A client can disconnect internally,
for example, during link reset or upon FW request. Those are legitimate
flows and we should not log an error message, hence we demote
'Already disconnected' message to the debug level.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-31 04:00:09 -06:00
Alexander Usyskin 88d1bece89 mei: show the HBM protocol versions in the device attributes
The HBM protocol version is negotiated during the setup phase, then settled
on a highest possible common version of the driver and the firmware.
The sysfs API advertises both negotiated and driver supported versions
in the device attributes.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-31 04:00:09 -06:00
Greg Kroah-Hartman d4608a83f7 Merge 4.9-rc3 into char-misc-next
We need the binder patches in here to build on for other submitted
patches to apply properly.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-30 06:25:44 -04:00
Tomas Winkler 1e4edb3fe9 mei: bus: remove rx callback context
The callback context is redunant as all the information can be
retrived from the device struture of its private data.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-28 08:21:22 -04:00
Alexander Usyskin 43605e293e mei: txe: don't clean an unprocessed interrupt cause.
SEC registers are not accessible when the TXE device is in low power
state, hence the SEC interrupt cannot be processed if device is not
awake.

In some rare cases entrance to low power state (aliveness off) and input
ready bits can be signaled at the same time, resulting in communication
stall as input ready won't be signaled again after waking up. To resolve
this IPC_HHIER_SEC bit in HHISR_REG should not be cleaned if the
interrupt is not processed.

Cc: stable@vger.kernel.org
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-24 19:38:39 +02:00
Alexander Usyskin 1892fc2ee4 mei: stop the stall timer worker if not needed
The stall timer worker checks periodically if there is a stalled i/o
transaction. The issue with the current implementation is that the timer
is ticking also when there is no pending i/o transaction.
This patch provides a simple change that prevents rescheduling
of the delayed work when there is no pending i/o.

Cc: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-27 12:33:47 +02:00
Alexander Usyskin ac182e8abc mei: me: add kaby point device ids
Add device ids for Intel Kabypoint PCH (Kabylake)

Cc: <stable@vger.kernel.org> #4.6+
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-12 15:32:29 +02:00
Greg Kroah-Hartman fbc1ec2efe Merge 4.8-rc5 into char-misc-next
We want the fixes in here for merging and testing.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-05 08:04:07 +02:00
Alexander Usyskin e728ae271f mei: amthif: fix deadlock in initialization during a reset
The device lock was unnecessary obtained in bus rescan work before the
amthif client search.  That causes incorrect lock ordering and task
hang:
...
[88004.613213] INFO: task kworker/1:14:21832 blocked for more than 120 seconds.
...
[88004.645934] Workqueue: events mei_cl_bus_rescan_work
...

The correct lock order is
 cl_bus_lock
  device_lock
   me_clients_rwsem

Move device_lock into amthif init function that called
after me_clients_rwsem is released.

This fixes regression introduced by commit:
commit 025fb792ba ("mei: split amthif client init from end of clients enumeration")

Cc: <stable@vger.kernel.org> # 4.6+
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-30 14:39:43 +02:00
Alexander Usyskin 80293c47a6 mei: drop unused file transaction states
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-30 14:39:42 +02:00
Alexander Usyskin 9d27e73c18 mei: amthif: drop mei_amthif_read
mei_amthif_read have only one difference from mei_read, it is not
calling mei_read_start().
Make mei_read_start return immediately for amthif client and drop the
special mei_amthif_read function.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-30 14:39:42 +02:00
Alexander Usyskin ff1586a7ea mei: enqueue consecutive reads
The FW supports only one pending read per host client, in order to
support  issuing of consecutive reads the driver  queues read requests
internally and send them to the firmware after pending one has
completed.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-30 14:39:42 +02:00
Tomas Winkler 3030dc0564 mei: add wrapper for queuing control commands.
Enclose the boiler plate code of allocating a control/hbm command cb
and enqueueing it onto ctrl_wr.list in a convenient wrapper
mei_cl_enqueue_ctrl_wr_cb().

This is a preparatory patch for enabling consecutive reads.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-30 14:39:42 +02:00
Tomas Winkler 4034b81ba3 mei: use consistent naming for TX control flow credits
With the introduction of the receive control flow credits prefixed with
rx_ we add tx_ prefix to the variables and function used for tracking
the transmit control flow credits.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-30 14:39:42 +02:00
Alexander Usyskin 46978ada7d mei: rx flow control counter
Use RX flow control counter in the host client structure to
track the number of simultaneous outstanding reads.
This eliminates search in queues and makes ground for
enabling for parallel read.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-30 14:39:42 +02:00
Alexander Usyskin e51dfa5a7f mei: prepare read cb for fixed address clients on the receive path only.
The read callbacks for the fixed address clients, that don't have flow
control are built now on the receive path. In order to have a single
allocation place we remove the allocation from the read request.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-30 14:39:42 +02:00
Alexander Usyskin dfe5f753d0 mei: drop redundant krealloc and checks in irq read
The read callback is always prepared with MTU-sized buffer and the FW
can't send more than the MTU in one message.
Checking for buffer existence and krealloc to increase receive buffer
size are redundant and may be safely discarded.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-30 14:39:42 +02:00
Alexander Usyskin c85dba9e87 mei: amthif: drop mei_clear_lists function
Open code mei_clear_lists into its only caller mei_amthif_releas
and drop unused parameter 'dev' form from mei_clear_list function.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-30 14:36:40 +02:00
Alexander Usyskin a808c80cda mei: add read callback on demand for fixed_address clients
The Fixed address clients do not work with the flow control, and the
packet RX callback was allocated upon TX with anticipation of a
following RX. This won't work if the clients with unsolicited Rx. Rather
than preparing read callback upon a write we allocate one directly on
the reciev path if one doesn't exists.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-30 14:36:39 +02:00
Alexander Usyskin 97d549b4d5 mei: add file pointer to the host client structure
Store the file associated with a client in the host client structure,
this enables dropping the special amthif client file pointer from struct
mei_device, and this is also a preparation for changing the way rx
packet allocation for fixed_address clients

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-30 14:36:39 +02:00
Alexander Usyskin a03c608f25 mei: move read cb to complete queue if not connected
Move read cb to the completion queue if a read finds out that client
is not connected. This expedite user space reader wake on error
condition.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-30 14:36:39 +02:00
Tomas Winkler 2d4d5481e2 mei: fix return value on disconnection
Correct errno on client disconnection is -ENODEV not -EBUSY

Cc: <stable@vger.kernel.org> #4.3+
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-30 14:36:39 +02:00
Alexander Usyskin 1eb5bd4d83 mei: drop read complete queue emptiness check
In the course of the read flow we want to wait for read completion only
if the read queue is empty.
However the calling list_empty(&cl->rd_completed) is a duplication as the
same check was performed by mei_cl_read_cb() and the waiting is skipped
if it returns not NULL.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-30 14:36:39 +02:00
Tomas Winkler 041330d9c3 mei: hbm: add missing argument in the kdoc
In mei_hbm_cl_hdr buf argument was not described

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-30 14:36:39 +02:00
Alexander Usyskin 77537ad291 mei: recover after errors in runtime pm flow
Schedule link reset if failed to perform runtime suspend or resume.
Set active runtime pm stte on link reset
to clean runtimr pm error, if present.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-30 14:36:39 +02:00
Alexander Usyskin aab3b1a34a mei: drop mei_io_cb_alloc_buf
mei_io_cb_alloc_buf have a single caller :mei_cl_alloc_cb. After amthif
stopped using it, the code can be integrated into the caller and the
function can be dropped.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-30 14:35:14 +02:00
Alexander Usyskin 35eda92afa mei: amthif: use mei_cl_alloc_cb for allocating cbs
Use mei_cl_alloc_cb wrapper instead of open code steps

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-30 14:35:14 +02:00
Alexander Usyskin 22393381a4 mei: amthif: drop mei_amthif_send_cmd
Incorporate the mei_amthif_send_cmd code into its only caller:
mei_amthif_run_next_cmd

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-30 14:35:14 +02:00
Alexander Usyskin 9fa0be8bb6 mei: amthif: enable poll for async events
Currently the poll function is bailing early for amthif client and
ignores requests for async events notifications.
Move async event processing before amthif to enable async events
notifications on amthif client.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-30 14:35:14 +02:00
Alexander Usyskin bca7dbacfd mei: amthif: drop iamthif_current_cb
iamthif_current_cb was used in request cancel in amthif code.
Now a canceled request is discarded only at the end of the processing
and the variable lost its purpose and can be safely removed.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-30 14:35:14 +02:00
Alexander Usyskin 32a1dc1d02 mei: amthif: fix request cancel
Currently, all requests cancelled by the user are immediately removed
from the queues. Such removal can cause unexpected behavior in the case
when a request is partially written or a  reply is received after the
request is cancelled.  To resolve this a request is always fully
processed and the result is discarded in case the request was canceled.
This completes the partial fix in commit:
9d04ee1 ("mei: amthif: discard not read messages")

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-30 14:35:14 +02:00
Alexander Usyskin ca455fafc2 mei: amthif: drop READ_COMPLETE state
AMTHIF code now uses read completed queue to store replies from the FW.
It is possible to send the next request as soon as a read from the FW is
completed. With these changes we don't need the READ_COMPLETE state.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-30 14:35:13 +02:00
Tomas Winkler 8c57cac145 mei: me: disable driver on SPT SPS firmware
Sunrise Point PCH with SPS Firmware doesn't expose working
MEI interface, we need to quirk it out.
The SPS Firmware is identifiable only on the first PCI function
of the device.

Cc: <stable@vger.kernel.org> #4.6+
Tested-by: Sujith Pandel <sujith_pandel@dell.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-30 14:34:04 +02:00
Greg Kroah-Hartman 194c8581eb Merge 4.7-rc4 into char-misc-next
We want those fixes in here to help with merge issues.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25 07:29:44 -07:00
Alexander Usyskin 69f1804a9a mei: don't use wake_up_interruptible for wr_ctrl
wr_ctrl waiters are none interruptible, so should be waken up
with call to wake_up and not to wake_up_interruptible.

This fixes commit:
7ff4bdd ("mei: fix waiting for wr_ctrl for corner cases.")

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-10 22:14:24 -07:00
Alexander Usyskin c0ff9019ee mei: drop wr_msg from the mei_dev structure
The control messages are usually small, around 8 bytes, and can be
allocated on the stack.
Using on stack allocation allows us to drop 'wr_msg' a rather large
buffer reserved in the mei_dev structure and relax contention
of this device global buffer.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-10 22:09:41 -07:00
Alexander Usyskin bc46b45a42 mei: bus: call mei_cl_read_start under device lock
Ensure that mei_cl_read_start is called under the device lock
also in the bus layer. The function updates global ctrl_wr_list
which should be locked.

Cc: <stable@vger.kernel.org> #4.4+
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-05-03 15:07:35 -07:00
Alexander Usyskin 7ff4bdd454 mei: fix waiting for wr_ctrl for corner cases.
A control message reply may not be received if either a link reset has
occurred or disconnection is initiated by the FW.
In the both cases the client state will be set straight to DISCONNECTED
and the driver will wait till timeout.
Adding DISCONNECTED state in the waiting condition will release the
client from the stall.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-30 14:08:08 -07:00
Alexander Usyskin 4a8eaa96d8 mei: don't clean control queues on notify request timeout
Timeout on notify request is not a fatal condition, and actually
cleaning control queues will disrupt other control flows of the
same client.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-30 14:08:08 -07:00
Alexander Usyskin 9d04ee11db mei: amthif: discard not read messages
When a message is received and amthif client is not in reading state
the message is ignored and left dangling in the queue. This may happen
after one of the amthif host connections is closed w/o completing the
reading. Another client will pick up a wrong message on next read
attempt which will lead to link reset.
To prevent this the driver has to properly discard the message when
amthif client is not in reading state.

Cc: <stable@vger.kernel.org> #4.2+
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-30 14:08:08 -07:00
Alexander Usyskin 6a8d648c8d mei: fix NULL dereferencing during FW initiated disconnection
In the case when disconnection is initiated from the FW
the driver is flushing items from the write control list while
iterating over it:

mei_irq_write_handler()
    list_for_each_entry_safe(ctrl_wr_list)         <-- outer loop
         mei_cl_irq_disconnect_rsp()
             mei_cl_set_disconnected()
                 mei_io_list_flush(ctrl_wr_list)   <-- destorying list

We move the list flushing to the completion routine.

Cc: <stable@vger.kernel.org> #4.2+
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-30 14:08:08 -07:00
Alexander Usyskin cc25aa94e4 mei: drop global me_client_index
Global me_client_index is used only during the enumeration process and
can be effectively replaced by me_addr data from the last enumeration
response as we always enumerate clients in the increasing order.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-30 14:08:08 -07:00
Alexey Khoroshilov b9c79543ef mei: do not pin module if cldrv->probe() failed
If cldrv->probe() failed in mei_cl_device_probe(),
the mei module is left pinned.

The patch moves __module_get(THIS_MODULE) after cldrv->probe().

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-30 14:08:08 -07:00
Rasmus Villemoes 423de92f56 mei: bus: use scnprintf in *_show
There's no reason to duplicate the logic provided by scnprintf().

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-31 16:43:05 -07:00