Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/ieee1394/linux1394-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6:
  firewire: ohci: wait for local CSR lock access to finish
  firewire: ohci: prevent aliasing of locally handled register addresses
  firewire: core: fw_iso_resource_manage: return -EBUSY when out of resources
  firewire: core: fix retries calculation in iso manage_channel()
  firewire: cdev: fix cut+paste mistake in disclaimer
  • Loading branch information
Linus Torvalds committed Apr 22, 2010
2 parents 4c6a399 + e139366 commit cfc94b2
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 15 deletions.
14 changes: 10 additions & 4 deletions drivers/firewire/core-iso.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ static int manage_bandwidth(struct fw_card *card, int irm_id, int generation,
for (try = 0; try < 5; try++) {
new = allocate ? old - bandwidth : old + bandwidth;
if (new < 0 || new > BANDWIDTH_AVAILABLE_INITIAL)
break;
return -EBUSY;

data[0] = cpu_to_be32(old);
data[1] = cpu_to_be32(new);
Expand Down Expand Up @@ -218,14 +218,16 @@ static int manage_channel(struct fw_card *card, int irm_id, int generation,
u32 channels_mask, u64 offset, bool allocate, __be32 data[2])
{
__be32 c, all, old;
int i, retry = 5;
int i, ret = -EIO, retry = 5;

old = all = allocate ? cpu_to_be32(~0) : 0;

for (i = 0; i < 32; i++) {
if (!(channels_mask & 1 << i))
continue;

ret = -EBUSY;

c = cpu_to_be32(1 << (31 - i));
if ((old & c) != (all & c))
continue;
Expand All @@ -251,12 +253,16 @@ static int manage_channel(struct fw_card *card, int irm_id, int generation,

/* 1394-1995 IRM, fall through to retry. */
default:
if (retry--)
if (retry) {
retry--;
i--;
} else {
ret = -EIO;
}
}
}

return -EIO;
return ret;
}

static void deallocate_channel(struct fw_card *card, int irm_id,
Expand Down
23 changes: 14 additions & 9 deletions drivers/firewire/ohci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,7 @@ static void handle_local_lock(struct fw_ohci *ohci,
struct fw_packet *packet, u32 csr)
{
struct fw_packet response;
int tcode, length, ext_tcode, sel;
int tcode, length, ext_tcode, sel, try;
__be32 *payload, lock_old;
u32 lock_arg, lock_data;

Expand All @@ -1185,21 +1185,26 @@ static void handle_local_lock(struct fw_ohci *ohci,
reg_write(ohci, OHCI1394_CSRCompareData, lock_arg);
reg_write(ohci, OHCI1394_CSRControl, sel);

if (reg_read(ohci, OHCI1394_CSRControl) & 0x80000000)
lock_old = cpu_to_be32(reg_read(ohci, OHCI1394_CSRData));
else
fw_notify("swap not done yet\n");
for (try = 0; try < 20; try++)
if (reg_read(ohci, OHCI1394_CSRControl) & 0x80000000) {
lock_old = cpu_to_be32(reg_read(ohci,
OHCI1394_CSRData));
fw_fill_response(&response, packet->header,
RCODE_COMPLETE,
&lock_old, sizeof(lock_old));
goto out;
}

fw_error("swap not done (CSR lock timeout)\n");
fw_fill_response(&response, packet->header, RCODE_BUSY, NULL, 0);

fw_fill_response(&response, packet->header,
RCODE_COMPLETE, &lock_old, sizeof(lock_old));
out:
fw_core_handle_response(&ohci->card, &response);
}

static void handle_local_request(struct context *ctx, struct fw_packet *packet)
{
u64 offset;
u32 csr;
u64 offset, csr;

if (ctx == &ctx->ohci->at_request_ctx) {
packet->ack = ACK_PENDING;
Expand Down
2 changes: 1 addition & 1 deletion include/linux/firewire-cdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
Expand Down
2 changes: 1 addition & 1 deletion include/linux/firewire-constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
Expand Down

0 comments on commit cfc94b2

Please sign in to comment.