Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/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
This commit is contained in:
Linus Torvalds 2010-04-22 12:54:54 -07:00
commit cfc94b2c9a
4 changed files with 26 additions and 15 deletions

View File

@ -190,7 +190,7 @@ static int manage_bandwidth(struct fw_card *card, int irm_id, int generation,
for (try = 0; try < 5; try++) { for (try = 0; try < 5; try++) {
new = allocate ? old - bandwidth : old + bandwidth; new = allocate ? old - bandwidth : old + bandwidth;
if (new < 0 || new > BANDWIDTH_AVAILABLE_INITIAL) if (new < 0 || new > BANDWIDTH_AVAILABLE_INITIAL)
break; return -EBUSY;
data[0] = cpu_to_be32(old); data[0] = cpu_to_be32(old);
data[1] = cpu_to_be32(new); data[1] = cpu_to_be32(new);
@ -218,7 +218,7 @@ static int manage_channel(struct fw_card *card, int irm_id, int generation,
u32 channels_mask, u64 offset, bool allocate, __be32 data[2]) u32 channels_mask, u64 offset, bool allocate, __be32 data[2])
{ {
__be32 c, all, old; __be32 c, all, old;
int i, retry = 5; int i, ret = -EIO, retry = 5;
old = all = allocate ? cpu_to_be32(~0) : 0; old = all = allocate ? cpu_to_be32(~0) : 0;
@ -226,6 +226,8 @@ static int manage_channel(struct fw_card *card, int irm_id, int generation,
if (!(channels_mask & 1 << i)) if (!(channels_mask & 1 << i))
continue; continue;
ret = -EBUSY;
c = cpu_to_be32(1 << (31 - i)); c = cpu_to_be32(1 << (31 - i));
if ((old & c) != (all & c)) if ((old & c) != (all & c))
continue; continue;
@ -251,12 +253,16 @@ static int manage_channel(struct fw_card *card, int irm_id, int generation,
/* 1394-1995 IRM, fall through to retry. */ /* 1394-1995 IRM, fall through to retry. */
default: default:
if (retry--) if (retry) {
retry--;
i--; i--;
} else {
ret = -EIO;
}
} }
} }
return -EIO; return ret;
} }
static void deallocate_channel(struct fw_card *card, int irm_id, static void deallocate_channel(struct fw_card *card, int irm_id,

View File

@ -1158,7 +1158,7 @@ static void handle_local_lock(struct fw_ohci *ohci,
struct fw_packet *packet, u32 csr) struct fw_packet *packet, u32 csr)
{ {
struct fw_packet response; struct fw_packet response;
int tcode, length, ext_tcode, sel; int tcode, length, ext_tcode, sel, try;
__be32 *payload, lock_old; __be32 *payload, lock_old;
u32 lock_arg, lock_data; u32 lock_arg, lock_data;
@ -1185,21 +1185,26 @@ static void handle_local_lock(struct fw_ohci *ohci,
reg_write(ohci, OHCI1394_CSRCompareData, lock_arg); reg_write(ohci, OHCI1394_CSRCompareData, lock_arg);
reg_write(ohci, OHCI1394_CSRControl, sel); reg_write(ohci, OHCI1394_CSRControl, sel);
if (reg_read(ohci, OHCI1394_CSRControl) & 0x80000000) for (try = 0; try < 20; try++)
lock_old = cpu_to_be32(reg_read(ohci, OHCI1394_CSRData)); if (reg_read(ohci, OHCI1394_CSRControl) & 0x80000000) {
else lock_old = cpu_to_be32(reg_read(ohci,
fw_notify("swap not done yet\n"); 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: out:
fw_core_handle_response(&ohci->card, &response); fw_core_handle_response(&ohci->card, &response);
} }
static void handle_local_request(struct context *ctx, struct fw_packet *packet) static void handle_local_request(struct context *ctx, struct fw_packet *packet)
{ {
u64 offset; u64 offset, csr;
u32 csr;
if (ctx == &ctx->ohci->at_request_ctx) { if (ctx == &ctx->ohci->at_request_ctx) {
packet->ack = ACK_PENDING; packet->ack = ACK_PENDING;

View File

@ -17,7 +17,7 @@
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * 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, * 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 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE. * DEALINGS IN THE SOFTWARE.

View File

@ -17,7 +17,7 @@
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * 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, * 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 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE. * DEALINGS IN THE SOFTWARE.