Lines Matching refs:entry
111 ssize_t (*show)(struct pdcspath_entry *entry, char *buf);
112 ssize_t (*store)(struct pdcspath_entry *entry, const char *buf, size_t count);
152 pdcspath_fetch(struct pdcspath_entry *entry) in pdcspath_fetch() argument
156 if (!entry) in pdcspath_fetch()
159 devpath = &entry->devpath; in pdcspath_fetch()
162 entry, devpath, entry->addr); in pdcspath_fetch()
165 if (pdc_stable_read(entry->addr, devpath, sizeof(*devpath)) != PDC_OK) in pdcspath_fetch()
171 entry->dev = hwpath_to_device((struct hardware_path *)devpath); in pdcspath_fetch()
173 entry->ready = 1; in pdcspath_fetch()
175 DPRINTK("%s: device: 0x%p\n", __func__, entry->dev); in pdcspath_fetch()
193 pdcspath_store(struct pdcspath_entry *entry) in pdcspath_store() argument
197 BUG_ON(!entry); in pdcspath_store()
199 devpath = &entry->devpath; in pdcspath_store()
204 if (!entry->ready) { in pdcspath_store()
206 BUG_ON(!entry->dev); in pdcspath_store()
207 device_to_hwpath(entry->dev, (struct hardware_path *)devpath); in pdcspath_store()
212 entry, devpath, entry->addr); in pdcspath_store()
215 if (pdc_stable_write(entry->addr, devpath, sizeof(*devpath)) != PDC_OK) in pdcspath_store()
221 entry->ready = 2; in pdcspath_store()
223 DPRINTK("%s: device: 0x%p\n", __func__, entry->dev); in pdcspath_store()
234 pdcspath_hwpath_read(struct pdcspath_entry *entry, char *buf) in pdcspath_hwpath_read() argument
240 if (!entry || !buf) in pdcspath_hwpath_read()
243 read_lock(&entry->rw_lock); in pdcspath_hwpath_read()
244 devpath = &entry->devpath; in pdcspath_hwpath_read()
245 i = entry->ready; in pdcspath_hwpath_read()
246 read_unlock(&entry->rw_lock); in pdcspath_hwpath_read()
277 pdcspath_hwpath_write(struct pdcspath_entry *entry, const char *buf, size_t count) in pdcspath_hwpath_write() argument
285 if (!entry || !buf || !count) in pdcspath_hwpath_write()
322 "hardware path: %s\n", __func__, entry->name, buf); in pdcspath_hwpath_write()
327 write_lock(&entry->rw_lock); in pdcspath_hwpath_write()
328 entry->ready = 0; in pdcspath_hwpath_write()
329 entry->dev = dev; in pdcspath_hwpath_write()
332 pdcspath_store(entry); in pdcspath_hwpath_write()
335 sysfs_remove_link(&entry->kobj, "device"); in pdcspath_hwpath_write()
336 write_unlock(&entry->rw_lock); in pdcspath_hwpath_write()
338 ret = sysfs_create_link(&entry->kobj, &entry->dev->kobj, "device"); in pdcspath_hwpath_write()
342 entry->name, buf); in pdcspath_hwpath_write()
355 pdcspath_layer_read(struct pdcspath_entry *entry, char *buf) in pdcspath_layer_read() argument
361 if (!entry || !buf) in pdcspath_layer_read()
364 read_lock(&entry->rw_lock); in pdcspath_layer_read()
365 devpath = &entry->devpath; in pdcspath_layer_read()
366 i = entry->ready; in pdcspath_layer_read()
367 read_unlock(&entry->rw_lock); in pdcspath_layer_read()
393 pdcspath_layer_write(struct pdcspath_entry *entry, const char *buf, size_t count) in pdcspath_layer_write() argument
399 if (!entry || !buf || !count) in pdcspath_layer_write()
425 write_lock(&entry->rw_lock); in pdcspath_layer_write()
429 memcpy(&entry->devpath.layers, &layers, sizeof(layers)); in pdcspath_layer_write()
432 pdcspath_store(entry); in pdcspath_layer_write()
433 write_unlock(&entry->rw_lock); in pdcspath_layer_write()
436 entry->name, buf); in pdcspath_layer_write()
450 struct pdcspath_entry *entry = to_pdcspath_entry(kobj); in pdcspath_attr_show() local
455 ret = pdcs_attr->show(entry, buf); in pdcspath_attr_show()
471 struct pdcspath_entry *entry = to_pdcspath_entry(kobj); in pdcspath_attr_store() local
479 ret = pdcs_attr->store(entry, buf, count); in pdcspath_attr_store()
977 struct pdcspath_entry *entry; in pdcs_register_pathentries() local
981 for (i = 0; (entry = pdcspath_entries[i]); i++) in pdcs_register_pathentries()
982 rwlock_init(&entry->rw_lock); in pdcs_register_pathentries()
984 for (i = 0; (entry = pdcspath_entries[i]); i++) { in pdcs_register_pathentries()
985 write_lock(&entry->rw_lock); in pdcs_register_pathentries()
986 err = pdcspath_fetch(entry); in pdcs_register_pathentries()
987 write_unlock(&entry->rw_lock); in pdcs_register_pathentries()
992 entry->kobj.kset = paths_kset; in pdcs_register_pathentries()
993 err = kobject_init_and_add(&entry->kobj, &ktype_pdcspath, NULL, in pdcs_register_pathentries()
994 "%s", entry->name); in pdcs_register_pathentries()
999 write_lock(&entry->rw_lock); in pdcs_register_pathentries()
1000 entry->ready = 2; in pdcs_register_pathentries()
1001 write_unlock(&entry->rw_lock); in pdcs_register_pathentries()
1004 if (entry->dev) { in pdcs_register_pathentries()
1005 err = sysfs_create_link(&entry->kobj, &entry->dev->kobj, "device"); in pdcs_register_pathentries()
1009 kobject_uevent(&entry->kobj, KOBJ_ADD); in pdcs_register_pathentries()
1022 struct pdcspath_entry *entry; in pdcs_unregister_pathentries() local
1024 for (i = 0; (entry = pdcspath_entries[i]); i++) { in pdcs_unregister_pathentries()
1025 read_lock(&entry->rw_lock); in pdcs_unregister_pathentries()
1026 if (entry->ready >= 2) in pdcs_unregister_pathentries()
1027 kobject_put(&entry->kobj); in pdcs_unregister_pathentries()
1028 read_unlock(&entry->rw_lock); in pdcs_unregister_pathentries()