History log of /linux-master/sound/firewire/fireworks/fireworks_transaction.c
Revision Date Author Comments
# 02a9c6ee 13-Nov-2020 Dan Carpenter <dan.carpenter@oracle.com>

ALSA: firewire: Clean up a locking issue in copy_resp_to_buf()

The spin_lock/unlock_irq() functions cannot be nested. The problem is
that presumably we would want the IRQs to be re-enabled on the second
call the spin_unlock_irq() but instead it will be enabled at the first
call so IRQs will be enabled earlier than expected.

In this situation the copy_resp_to_buf() function is only called from
one function and it is called with IRQs disabled. We can just use
the regular spin_lock/unlock() functions.

Fixes: 555e8a8f7f14 ("ALSA: fireworks: Add command/response functionality into hwdep interface")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20201113101241.GB168908@mwanda
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# da607e19 29-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 345

Based on 1 normalized pattern(s):

licensed under the terms of the gnu general public license version 2

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-only

has been chosen to replace the boilerplate/reference in 88 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Alexios Zavras <alexios.zavras@intel.com>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190530000437.521539229@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 6b1ca4bc 31-Aug-2016 Takashi Sakamoto <o-takashi@sakamocchi.jp>

ALSA: fireworks: accessing to user space outside spinlock

In hwdep interface of fireworks driver, accessing to user space is in a
critical section with disabled local interrupt. Depending on architecture,
accessing to user space can cause page fault exception. Then local
processor stores machine status and handles the synchronous event. A
handler corresponding to the event can call task scheduler to wait for
preparing pages. In a case of usage of single core processor, the state to
disable local interrupt is worse because it don't handle usual interrupts
from hardware.

This commit fixes this bug, performing the accessing outside spinlock. This
commit also gives up counting the number of queued response messages to
simplify ring-buffer management.

Reported-by: Vaishali Thakkar <vaishali.thakkar@oracle.com>
Cc: stable@vger.kernel.org
Fixes: 555e8a8f7f14('ALSA: fireworks: Add command/response functionality into hwdep interface')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# ce991981 09-Mar-2015 Yannick Guerrini <yguerrini@tomshardware.fr>

ALSA: firewire: Fix trivial typos in comments

Change 'propper' to 'proper'
Change 'paramters' to 'parameters'
Change 'SYT_INTEVAL' to 'SYT_INTERVAL'
Change 'aligh'/'alighed' to 'align'/'aligned'

Signed-off-by: Yannick Guerrini <yguerrini@tomshardware.fr>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 92cb4658 07-Jan-2015 Takashi Sakamoto <o-takashi@sakamocchi.jp>

ALSA: fireworks: fix an endianness bug for transaction length

Although the 't->length' is a big-endian value, it's used without any
conversion. This means that the driver always uses 'length' parameter.

Fixes: 555e8a8f7f14("ALSA: fireworks: Add command/response functionality into hwdep interface")
Reported-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 72f784f7 04-Jun-2014 Takashi Sakamoto <o-takashi@sakamocchi.jp>

ALSA: fireworks: Improve comments about Fireworks transaction

It includes descriptions to cause misreading.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# cf44a136 04-Jun-2014 Takashi Sakamoto <o-takashi@sakamocchi.jp>

ALSA: fireworks: Use safer way to arrange ring buffer pointer

To reverse a pointer for the ring buffer, subtraction by buffer
size is better than assignment to the beginning of the buffer.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 9b5f0edf 27-May-2014 Takashi Sakamoto <o-takashi@sakamocchi.jp>

ALSA: fireworks/bebob: Add suffix for long long integer literal

This commit adds suffix to register values of each device, to supress 'sparse'
warnings. Additionally, this commit changes offset values with integer literal.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 555e8a8f 25-Apr-2014 Takashi Sakamoto <o-takashi@sakamocchi.jp>

ALSA: fireworks: Add command/response functionality into hwdep interface

This commit adds two functionality for hwdep interface, adds two parameters for
this driver, add a node for proc interface.

To receive responses from devices, this driver already allocate own callback
into initial memory space in host controller. This means no one can allocate
its own callback to the address. So this driver must give a way for user
applications to receive responses.

This commit adds a functionality to receive responses via hwdep interface. The
application can receive responses to read from this interface. To achieve this,
this commit adds a buffer to queue responses. The default size of this buffer is
1024 bytes. This size can be changed to give preferrable size to
'resp_buf_size' parameter for this driver. The application should notice rest
of space in this buffer because this driver don't push responses when this
buffer has no space.

Additionaly, this commit adds a functionality to transmit commands via hwdep
interface. The application can transmit commands to write into this interface.
I note that the application can transmit one command at once, but can receive
as many responses as possible untill the user-buffer is full.

When using these interfaces, the application must keep maximum number of
sequence number in command within the number in firewire.h because this driver
uses this number to distinguish the response is against the command by the
application or this driver.

Usually responses against commands which the application transmits are pushed
into this buffer. But to enable 'resp_buf_debug' parameter for this driver, all
responses are pushed into the buffer. When using this mode, I reccomend to
expand the size of buffer.

Finally this commit adds a new node into proc interface to output status of the
buffer.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# bde8a8f2 25-Apr-2014 Takashi Sakamoto <o-takashi@sakamocchi.jp>

ALSA: fireworks: Add transaction and some commands

Fireworks uses own command and response. This commit adds functionality to
transact and adds some commands required for sound card instance and kernel
streaming.

There are two ways to deliver substance of this transaction:
1.AV/C vendor dependent command for command/response
2.Async transaction to specific addresses for command/response

By way 1, I confirm AudioFire12 cannot correctly response to some commands with
firmware version 5.0 or later. This is also confirmed by FFADO. So this driver
implement way 2.

The address for response gives an issue. When this driver allocate own callback
function into the address, then no one can allocate its own callback function.
This situation is not good for applications in user-land. This issue is solved
in later commit.

I note there is a command to change the address for response if the device
supports. But this driver uses default value. So users should not execute this
command as long as hoping this driver works correctly.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>