aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2009-06-06 12:37:25 -0400
committerStefan Richter <stefanr@s5r6.in-berlin.de>2009-06-06 15:45:50 -0400
commit099d54143e49d49c33cd25779ca725191df59b73 (patch)
tree8237acfc84aa5057ce8c98b1301b6d54cf056ba0 /drivers/firewire
parente034d242593f12533c11742ce38c245a33e57dc7 (diff)
firewire: core: prepare for non-core children of card devices
The IP-over-1394 driver will add child devices beneath card devices which are not of type fw_device. Hence firewire-core's callbacks in device_for_each_child() and device_find_child() need to check for the device type now. Initial version written by Jay Fenlason. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire')
-rw-r--r--drivers/firewire/core-card.c8
-rw-r--r--drivers/firewire/core-device.c24
-rw-r--r--drivers/firewire/core.h2
3 files changed, 22 insertions, 12 deletions
diff --git a/drivers/firewire/core-card.c b/drivers/firewire/core-card.c
index ba6cd70b8518..4c1be64fdddd 100644
--- a/drivers/firewire/core-card.c
+++ b/drivers/firewire/core-card.c
@@ -190,12 +190,6 @@ void fw_core_remove_descriptor(struct fw_descriptor *desc)
190 mutex_unlock(&card_mutex); 190 mutex_unlock(&card_mutex);
191} 191}
192 192
193static int set_broadcast_channel(struct device *dev, void *data)
194{
195 fw_device_set_broadcast_channel(fw_device(dev), (long)data);
196 return 0;
197}
198
199static void allocate_broadcast_channel(struct fw_card *card, int generation) 193static void allocate_broadcast_channel(struct fw_card *card, int generation)
200{ 194{
201 int channel, bandwidth = 0; 195 int channel, bandwidth = 0;
@@ -205,7 +199,7 @@ static void allocate_broadcast_channel(struct fw_card *card, int generation)
205 if (channel == 31) { 199 if (channel == 31) {
206 card->broadcast_channel_allocated = true; 200 card->broadcast_channel_allocated = true;
207 device_for_each_child(card->device, (void *)(long)generation, 201 device_for_each_child(card->device, (void *)(long)generation,
208 set_broadcast_channel); 202 fw_device_set_broadcast_channel);
209 } 203 }
210} 204}
211 205
diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c
index 3f4e646367b7..d6e54a5173fc 100644
--- a/drivers/firewire/core-device.c
+++ b/drivers/firewire/core-device.c
@@ -59,7 +59,7 @@ int fw_csr_iterator_next(struct fw_csr_iterator *ci, int *key, int *value)
59} 59}
60EXPORT_SYMBOL(fw_csr_iterator_next); 60EXPORT_SYMBOL(fw_csr_iterator_next);
61 61
62static int is_fw_unit(struct device *dev); 62static bool is_fw_unit(struct device *dev);
63 63
64static int match_unit_directory(u32 *directory, u32 match_flags, 64static int match_unit_directory(u32 *directory, u32 match_flags,
65 const struct ieee1394_device_id *id) 65 const struct ieee1394_device_id *id)
@@ -599,7 +599,7 @@ static struct device_type fw_unit_type = {
599 .release = fw_unit_release, 599 .release = fw_unit_release,
600}; 600};
601 601
602static int is_fw_unit(struct device *dev) 602static bool is_fw_unit(struct device *dev)
603{ 603{
604 return dev->type == &fw_unit_type; 604 return dev->type == &fw_unit_type;
605} 605}
@@ -749,6 +749,11 @@ static struct device_type fw_device_type = {
749 .release = fw_device_release, 749 .release = fw_device_release,
750}; 750};
751 751
752static bool is_fw_device(struct device *dev)
753{
754 return dev->type == &fw_device_type;
755}
756
752static int update_unit(struct device *dev, void *data) 757static int update_unit(struct device *dev, void *data)
753{ 758{
754 struct fw_unit *unit = fw_unit(dev); 759 struct fw_unit *unit = fw_unit(dev);
@@ -785,6 +790,9 @@ static int lookup_existing_device(struct device *dev, void *data)
785 struct fw_card *card = new->card; 790 struct fw_card *card = new->card;
786 int match = 0; 791 int match = 0;
787 792
793 if (!is_fw_device(dev))
794 return 0;
795
788 down_read(&fw_device_rwsem); /* serialize config_rom access */ 796 down_read(&fw_device_rwsem); /* serialize config_rom access */
789 spin_lock_irq(&card->lock); /* serialize node access */ 797 spin_lock_irq(&card->lock); /* serialize node access */
790 798
@@ -824,7 +832,7 @@ static int lookup_existing_device(struct device *dev, void *data)
824 832
825enum { BC_UNKNOWN = 0, BC_UNIMPLEMENTED, BC_IMPLEMENTED, }; 833enum { BC_UNKNOWN = 0, BC_UNIMPLEMENTED, BC_IMPLEMENTED, };
826 834
827void fw_device_set_broadcast_channel(struct fw_device *device, int generation) 835static void set_broadcast_channel(struct fw_device *device, int generation)
828{ 836{
829 struct fw_card *card = device->card; 837 struct fw_card *card = device->card;
830 __be32 data; 838 __be32 data;
@@ -860,6 +868,14 @@ void fw_device_set_broadcast_channel(struct fw_device *device, int generation)
860 } 868 }
861} 869}
862 870
871int fw_device_set_broadcast_channel(struct device *dev, void *gen)
872{
873 if (is_fw_device(dev))
874 set_broadcast_channel(fw_device(dev), (long)gen);
875
876 return 0;
877}
878
863static void fw_device_init(struct work_struct *work) 879static void fw_device_init(struct work_struct *work)
864{ 880{
865 struct fw_device *device = 881 struct fw_device *device =
@@ -958,7 +974,7 @@ static void fw_device_init(struct work_struct *work)
958 1 << device->max_speed); 974 1 << device->max_speed);
959 device->config_rom_retries = 0; 975 device->config_rom_retries = 0;
960 976
961 fw_device_set_broadcast_channel(device, device->generation); 977 set_broadcast_channel(device, device->generation);
962 } 978 }
963 979
964 /* 980 /*
diff --git a/drivers/firewire/core.h b/drivers/firewire/core.h
index 273f0ab82928..0a25a7b38a80 100644
--- a/drivers/firewire/core.h
+++ b/drivers/firewire/core.h
@@ -124,7 +124,7 @@ extern struct idr fw_device_idr;
124extern int fw_cdev_major; 124extern int fw_cdev_major;
125 125
126struct fw_device *fw_device_get_by_devt(dev_t devt); 126struct fw_device *fw_device_get_by_devt(dev_t devt);
127void fw_device_set_broadcast_channel(struct fw_device *device, int generation); 127int fw_device_set_broadcast_channel(struct device *dev, void *gen);
128void fw_node_event(struct fw_card *card, struct fw_node *node, int event); 128void fw_node_event(struct fw_card *card, struct fw_node *node, int event);
129 129
130 130