Skip to content

Commit 2080222

Browse files
author
Stefan Richter
committed
firewire: core: add forgotten dummy driver methods, remove unused ones
There is an at least theoretic race condition in which .start_iso etc. could still be called between when the dummy driver is bound to the card and when the children devices are being shut down. Add dummy_start_iso and friends. On the other hand, .enable, .set_config_rom, .read_csr, write_csr do not need to be implemented by the dummy driver, as commented. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
1 parent 872e330 commit 2080222

File tree

1 file changed

+38
-26
lines changed

1 file changed

+38
-26
lines changed

drivers/firewire/core-card.c

Lines changed: 38 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -538,15 +538,13 @@ EXPORT_SYMBOL(fw_card_add);
538538
* as all IO to the card will be handled (and failed) by the dummy driver
539539
* instead of calling into the module. Only functions for iso context
540540
* shutdown still need to be provided by the card driver.
541+
*
542+
* .read/write_csr() should never be called anymore after the dummy driver
543+
* was bound since they are only used within request handler context.
544+
* .set_config_rom() is never called since the card is taken out of card_list
545+
* before switching to the dummy driver.
541546
*/
542547

543-
static int dummy_enable(struct fw_card *card,
544-
const __be32 *config_rom, size_t length)
545-
{
546-
BUG();
547-
return -1;
548-
}
549-
550548
static int dummy_read_phy_reg(struct fw_card *card, int address)
551549
{
552550
return -ENODEV;
@@ -558,17 +556,6 @@ static int dummy_update_phy_reg(struct fw_card *card, int address,
558556
return -ENODEV;
559557
}
560558

561-
static int dummy_set_config_rom(struct fw_card *card,
562-
const __be32 *config_rom, size_t length)
563-
{
564-
/*
565-
* We take the card out of card_list before setting the dummy
566-
* driver, so this should never get called.
567-
*/
568-
BUG();
569-
return -1;
570-
}
571-
572559
static void dummy_send_request(struct fw_card *card, struct fw_packet *packet)
573560
{
574561
packet->callback(packet, card, RCODE_CANCELLED);
@@ -590,15 +577,40 @@ static int dummy_enable_phys_dma(struct fw_card *card,
590577
return -ENODEV;
591578
}
592579

580+
static struct fw_iso_context *dummy_allocate_iso_context(struct fw_card *card,
581+
int type, int channel, size_t header_size)
582+
{
583+
return ERR_PTR(-ENODEV);
584+
}
585+
586+
static int dummy_start_iso(struct fw_iso_context *ctx,
587+
s32 cycle, u32 sync, u32 tags)
588+
{
589+
return -ENODEV;
590+
}
591+
592+
static int dummy_set_iso_channels(struct fw_iso_context *ctx, u64 *channels)
593+
{
594+
return -ENODEV;
595+
}
596+
597+
static int dummy_queue_iso(struct fw_iso_context *ctx, struct fw_iso_packet *p,
598+
struct fw_iso_buffer *buffer, unsigned long payload)
599+
{
600+
return -ENODEV;
601+
}
602+
593603
static const struct fw_card_driver dummy_driver_template = {
594-
.enable = dummy_enable,
595-
.read_phy_reg = dummy_read_phy_reg,
596-
.update_phy_reg = dummy_update_phy_reg,
597-
.set_config_rom = dummy_set_config_rom,
598-
.send_request = dummy_send_request,
599-
.cancel_packet = dummy_cancel_packet,
600-
.send_response = dummy_send_response,
601-
.enable_phys_dma = dummy_enable_phys_dma,
604+
.read_phy_reg = dummy_read_phy_reg,
605+
.update_phy_reg = dummy_update_phy_reg,
606+
.send_request = dummy_send_request,
607+
.send_response = dummy_send_response,
608+
.cancel_packet = dummy_cancel_packet,
609+
.enable_phys_dma = dummy_enable_phys_dma,
610+
.allocate_iso_context = dummy_allocate_iso_context,
611+
.start_iso = dummy_start_iso,
612+
.set_iso_channels = dummy_set_iso_channels,
613+
.queue_iso = dummy_queue_iso,
602614
};
603615

604616
void fw_card_release(struct kref *kref)

0 commit comments

Comments
 (0)