Lines Matching +defs:dev +defs:id +defs:attrs

136 static void get_ids(const u32 *directory, int *id)
144 case CSR_VENDOR: id[0] = value; break;
145 case CSR_MODEL: id[1] = value; break;
146 case CSR_SPECIFIER_ID: id[2] = value; break;
147 case CSR_VERSION: id[3] = value; break;
152 static void get_modalias_ids(const struct fw_unit *unit, int *id)
172 get_ids(directories[i], id);
175 static bool match_ids(const struct ieee1394_device_id *id_table, int *id)
179 if (id[0] == id_table->vendor_id)
181 if (id[1] == id_table->model_id)
183 if (id[2] == id_table->specifier_id)
185 if (id[3] == id_table->version)
191 static const struct ieee1394_device_id *unit_match(struct device *dev,
196 int id[] = {0, 0, 0, 0};
198 get_modalias_ids(fw_unit(dev), id);
201 if (match_ids(id_table, id))
207 static bool is_fw_unit(const struct device *dev);
209 static int fw_unit_match(struct device *dev, const struct device_driver *drv)
212 return is_fw_unit(dev) && unit_match(dev, drv) != NULL;
215 static int fw_unit_probe(struct device *dev)
218 container_of(dev->driver, struct fw_driver, driver);
220 return driver->probe(fw_unit(dev), unit_match(dev, dev->driver));
223 static void fw_unit_remove(struct device *dev)
226 container_of(dev->driver, struct fw_driver, driver);
228 driver->remove(fw_unit(dev));
233 int id[] = {0, 0, 0, 0};
235 get_modalias_ids(unit, id);
239 id[0], id[1], id[2], id[3]);
242 static int fw_unit_uevent(const struct device *dev, struct kobj_uevent_env *env)
244 const struct fw_unit *unit = fw_unit(dev);
281 static ssize_t show_immediate(struct device *dev,
292 if (is_fw_unit(dev)) {
293 directories[0] = fw_unit(dev)->directory;
295 const u32 *root_directory = fw_device(dev)->config_rom + ROOT_DIR_OFFSET;
329 static ssize_t show_text_leaf(struct device *dev,
341 if (is_fw_unit(dev)) {
342 directories[0] = fw_unit(dev)->directory;
344 const u32 *root_directory = fw_device(dev)->config_rom + ROOT_DIR_OFFSET;
408 static void init_fw_attribute_group(struct device *dev,
409 struct device_attribute *attrs,
415 for (j = 0; attrs[j].attr.name != NULL; j++)
416 group->attrs[j] = &attrs[j].attr;
420 if (attr->show(dev, attr, NULL) < 0)
422 group->attrs[j++] = &attr->attr;
425 group->attrs[j] = NULL;
428 group->group.attrs = group->attrs;
429 dev->groups = (const struct attribute_group **) group->groups;
432 static ssize_t modalias_show(struct device *dev,
435 struct fw_unit *unit = fw_unit(dev);
444 static ssize_t rom_index_show(struct device *dev,
447 struct fw_device *device = fw_device(dev->parent);
448 struct fw_unit *unit = fw_unit(dev);
459 static ssize_t config_rom_show(struct device *dev,
462 struct fw_device *device = fw_device(dev);
473 static ssize_t guid_show(struct device *dev,
476 struct fw_device *device = fw_device(dev);
483 static ssize_t is_local_show(struct device *dev,
486 struct fw_device *device = fw_device(dev);
513 static ssize_t units_show(struct device *dev,
516 struct fw_device *device = fw_device(dev);
742 static void fw_unit_release(struct device *dev)
744 struct fw_unit *unit = fw_unit(dev);
755 static bool is_fw_unit(const struct device *dev)
757 return dev->type == &fw_unit_type;
786 BUILD_BUG_ON(ARRAY_SIZE(unit->attribute_group.attrs) <
880 static void fw_device_release(struct device *dev)
882 struct fw_device *device = fw_device(dev);
903 static bool is_fw_device(const struct device *dev)
905 return dev->type == &fw_device_type;
908 static int update_unit(struct device *dev, void *data)
910 struct fw_unit *unit = fw_unit(dev);
911 struct fw_driver *driver = (struct fw_driver *)dev->driver;
913 if (is_fw_unit(dev) && driver != NULL && driver->update != NULL) {
914 device_lock(dev);
916 device_unlock(dev);
983 int fw_device_set_broadcast_channel(struct device *dev, void *gen)
985 if (is_fw_device(dev))
986 set_broadcast_channel(fw_device(dev), (long)gen);
991 static int compare_configuration_rom(struct device *dev, const void *data)
993 const struct fw_device *old = fw_device(dev);
996 if (!is_fw_device(dev))
1100 BUILD_BUG_ON(ARRAY_SIZE(device->attribute_group.attrs) <