Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 136000
b: refs/heads/master
c: 4817ed2
h: refs/heads/master
v: v3
  • Loading branch information
Stefan Richter committed Mar 24, 2009
1 parent a58e903 commit e6c7052
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a459b8ab9c176143fecef8ace4b70d6dbd7a8113
refs/heads/master: 4817ed240232e89583b0506c2d8e426739af5da3
3 changes: 2 additions & 1 deletion trunk/drivers/firewire/fw-iso.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ struct fw_iso_context *fw_iso_context_create(struct fw_card *card,
{
struct fw_iso_context *ctx;

ctx = card->driver->allocate_iso_context(card, type, header_size);
ctx = card->driver->allocate_iso_context(card,
type, channel, header_size);
if (IS_ERR(ctx))
return ctx;

Expand Down
14 changes: 11 additions & 3 deletions trunk/drivers/firewire/fw-ohci.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ struct fw_ohci {

u32 it_context_mask;
struct iso_context *it_context_list;
u64 ir_context_channels;
u32 ir_context_mask;
struct iso_context *ir_context_list;
};
Expand Down Expand Up @@ -1877,20 +1878,23 @@ static int handle_it_packet(struct context *context,
}

static struct fw_iso_context *ohci_allocate_iso_context(struct fw_card *card,
int type, size_t header_size)
int type, int channel, size_t header_size)
{
struct fw_ohci *ohci = fw_ohci(card);
struct iso_context *ctx, *list;
descriptor_callback_t callback;
u64 *channels, dont_care = ~0ULL;
u32 *mask, regs;
unsigned long flags;
int index, ret = -ENOMEM;

if (type == FW_ISO_CONTEXT_TRANSMIT) {
channels = &dont_care;
mask = &ohci->it_context_mask;
list = ohci->it_context_list;
callback = handle_it_packet;
} else {
channels = &ohci->ir_context_channels;
mask = &ohci->ir_context_mask;
list = ohci->ir_context_list;
if (ohci->use_dualbuffer)
Expand All @@ -1900,9 +1904,11 @@ static struct fw_iso_context *ohci_allocate_iso_context(struct fw_card *card,
}

spin_lock_irqsave(&ohci->lock, flags);
index = ffs(*mask) - 1;
if (index >= 0)
index = *channels & 1ULL << channel ? ffs(*mask) - 1 : -1;
if (index >= 0) {
*channels &= ~(1ULL << channel);
*mask &= ~(1 << index);
}
spin_unlock_irqrestore(&ohci->lock, flags);

if (index < 0)
Expand Down Expand Up @@ -2012,6 +2018,7 @@ static void ohci_free_iso_context(struct fw_iso_context *base)
} else {
index = ctx - ohci->ir_context_list;
ohci->ir_context_mask |= 1 << index;
ohci->ir_context_channels |= 1ULL << base->channel;
}

spin_unlock_irqrestore(&ohci->lock, flags);
Expand Down Expand Up @@ -2424,6 +2431,7 @@ static int __devinit pci_probe(struct pci_dev *dev,
ohci->it_context_list = kzalloc(size, GFP_KERNEL);

reg_write(ohci, OHCI1394_IsoXmitIntMaskSet, ~0);
ohci->ir_context_channels = ~0ULL;
ohci->ir_context_mask = reg_read(ohci, OHCI1394_IsoXmitIntMaskSet);
reg_write(ohci, OHCI1394_IsoXmitIntMaskClear, ~0);
size = sizeof(struct iso_context) * hweight32(ohci->ir_context_mask);
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/firewire/fw-transaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ struct fw_card_driver {

struct fw_iso_context *
(*allocate_iso_context)(struct fw_card *card,
int type, size_t header_size);
int type, int channel, size_t header_size);
void (*free_iso_context)(struct fw_iso_context *ctx);

int (*start_iso)(struct fw_iso_context *ctx,
Expand Down

0 comments on commit e6c7052

Please sign in to comment.