Lines Matching +refs:dev +refs:id +refs:attrs
120 static void get_ids(const u32 *directory, int *id) in get_ids() argument
128 case CSR_VENDOR: id[0] = value; break; in get_ids()
129 case CSR_MODEL: id[1] = value; break; in get_ids()
130 case CSR_SPECIFIER_ID: id[2] = value; break; in get_ids()
131 case CSR_VERSION: id[3] = value; break; in get_ids()
136 static void get_modalias_ids(const struct fw_unit *unit, int *id) in get_modalias_ids() argument
138 get_ids(&fw_parent_device(unit)->config_rom[5], id); in get_modalias_ids()
139 get_ids(unit->directory, id); in get_modalias_ids()
142 static bool match_ids(const struct ieee1394_device_id *id_table, int *id) in match_ids() argument
146 if (id[0] == id_table->vendor_id) in match_ids()
148 if (id[1] == id_table->model_id) in match_ids()
150 if (id[2] == id_table->specifier_id) in match_ids()
152 if (id[3] == id_table->version) in match_ids()
158 static const struct ieee1394_device_id *unit_match(struct device *dev, in unit_match() argument
163 int id[] = {0, 0, 0, 0}; in unit_match() local
165 get_modalias_ids(fw_unit(dev), id); in unit_match()
168 if (match_ids(id_table, id)) in unit_match()
174 static bool is_fw_unit(struct device *dev);
176 static int fw_unit_match(struct device *dev, struct device_driver *drv) in fw_unit_match() argument
179 return is_fw_unit(dev) && unit_match(dev, drv) != NULL; in fw_unit_match()
182 static int fw_unit_probe(struct device *dev) in fw_unit_probe() argument
185 container_of(dev->driver, struct fw_driver, driver); in fw_unit_probe()
187 return driver->probe(fw_unit(dev), unit_match(dev, dev->driver)); in fw_unit_probe()
190 static void fw_unit_remove(struct device *dev) in fw_unit_remove() argument
193 container_of(dev->driver, struct fw_driver, driver); in fw_unit_remove()
195 driver->remove(fw_unit(dev)); in fw_unit_remove()
200 int id[] = {0, 0, 0, 0}; in get_modalias() local
202 get_modalias_ids(unit, id); in get_modalias()
206 id[0], id[1], id[2], id[3]); in get_modalias()
209 static int fw_unit_uevent(const struct device *dev, struct kobj_uevent_env *env) in fw_unit_uevent() argument
211 const struct fw_unit *unit = fw_unit(dev); in fw_unit_uevent()
248 static ssize_t show_immediate(struct device *dev, in show_immediate() argument
259 if (is_fw_unit(dev)) in show_immediate()
260 dir = fw_unit(dev)->directory; in show_immediate()
262 dir = fw_device(dev)->config_rom + 5; in show_immediate()
280 static ssize_t show_text_leaf(struct device *dev, in show_text_leaf() argument
292 if (is_fw_unit(dev)) in show_text_leaf()
293 dir = fw_unit(dev)->directory; in show_text_leaf()
295 dir = fw_device(dev)->config_rom + 5; in show_text_leaf()
333 static void init_fw_attribute_group(struct device *dev, in init_fw_attribute_group() argument
334 struct device_attribute *attrs, in init_fw_attribute_group() argument
340 for (j = 0; attrs[j].attr.name != NULL; j++) in init_fw_attribute_group()
341 group->attrs[j] = &attrs[j].attr; in init_fw_attribute_group()
345 if (attr->show(dev, attr, NULL) < 0) in init_fw_attribute_group()
347 group->attrs[j++] = &attr->attr; in init_fw_attribute_group()
350 group->attrs[j] = NULL; in init_fw_attribute_group()
353 group->group.attrs = group->attrs; in init_fw_attribute_group()
354 dev->groups = (const struct attribute_group **) group->groups; in init_fw_attribute_group()
357 static ssize_t modalias_show(struct device *dev, in modalias_show() argument
360 struct fw_unit *unit = fw_unit(dev); in modalias_show()
369 static ssize_t rom_index_show(struct device *dev, in rom_index_show() argument
372 struct fw_device *device = fw_device(dev->parent); in rom_index_show()
373 struct fw_unit *unit = fw_unit(dev); in rom_index_show()
384 static ssize_t config_rom_show(struct device *dev, in config_rom_show() argument
387 struct fw_device *device = fw_device(dev); in config_rom_show()
398 static ssize_t guid_show(struct device *dev, in guid_show() argument
401 struct fw_device *device = fw_device(dev); in guid_show()
411 static ssize_t is_local_show(struct device *dev, in is_local_show() argument
414 struct fw_device *device = fw_device(dev); in is_local_show()
441 static ssize_t units_show(struct device *dev, in units_show() argument
444 struct fw_device *device = fw_device(dev); in units_show()
669 static void fw_unit_release(struct device *dev) in fw_unit_release() argument
671 struct fw_unit *unit = fw_unit(dev); in fw_unit_release()
682 static bool is_fw_unit(struct device *dev) in is_fw_unit() argument
684 return dev->type == &fw_unit_type; in is_fw_unit()
713 BUILD_BUG_ON(ARRAY_SIZE(unit->attribute_group.attrs) < in create_units()
816 static void fw_device_release(struct device *dev) in fw_device_release() argument
818 struct fw_device *device = fw_device(dev); in fw_device_release()
841 static bool is_fw_device(struct device *dev) in is_fw_device() argument
843 return dev->type == &fw_device_type; in is_fw_device()
846 static int update_unit(struct device *dev, void *data) in update_unit() argument
848 struct fw_unit *unit = fw_unit(dev); in update_unit()
849 struct fw_driver *driver = (struct fw_driver *)dev->driver; in update_unit()
851 if (is_fw_unit(dev) && driver != NULL && driver->update != NULL) { in update_unit()
852 device_lock(dev); in update_unit()
854 device_unlock(dev); in update_unit()
875 static int lookup_existing_device(struct device *dev, void *data) in lookup_existing_device() argument
877 struct fw_device *old = fw_device(dev); in lookup_existing_device()
882 if (!is_fw_device(dev)) in lookup_existing_device()
905 fw_notice(card, "rediscovered device %s\n", dev_name(dev)); in lookup_existing_device()
974 int fw_device_set_broadcast_channel(struct device *dev, void *gen) in fw_device_set_broadcast_channel() argument
976 if (is_fw_device(dev)) in fw_device_set_broadcast_channel()
977 set_broadcast_channel(fw_device(dev), (long)gen); in fw_device_set_broadcast_channel()
1040 BUILD_BUG_ON(ARRAY_SIZE(device->attribute_group.attrs) < in fw_device_init()