forked from Minki/linux
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:
commit
cfc94b2c9a
@ -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);
|
||||
@ -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])
|
||||
{
|
||||
__be32 c, all, old;
|
||||
int i, retry = 5;
|
||||
int i, ret = -EIO, retry = 5;
|
||||
|
||||
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))
|
||||
continue;
|
||||
|
||||
ret = -EBUSY;
|
||||
|
||||
c = cpu_to_be32(1 << (31 - i));
|
||||
if ((old & c) != (all & c))
|
||||
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. */
|
||||
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,
|
||||
|
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user