Lines Matching refs:entry
98 ssize_t (*show)(struct pdcspath_entry *entry, char *buf);
99 ssize_t (*store)(struct pdcspath_entry *entry, const char *buf, size_t count);
139 pdcspath_fetch(struct pdcspath_entry *entry) in pdcspath_fetch() argument
143 if (!entry) in pdcspath_fetch()
146 devpath = &entry->devpath; in pdcspath_fetch()
149 entry, devpath, entry->addr); in pdcspath_fetch()
152 if (pdc_stable_read(entry->addr, devpath, sizeof(*devpath)) != PDC_OK) in pdcspath_fetch()
158 entry->dev = hwpath_to_device((struct hardware_path *)devpath); in pdcspath_fetch()
160 entry->ready = 1; in pdcspath_fetch()
162 DPRINTK("%s: device: 0x%p\n", __func__, entry->dev); in pdcspath_fetch()
180 pdcspath_store(struct pdcspath_entry *entry) in pdcspath_store() argument
184 BUG_ON(!entry); in pdcspath_store()
186 devpath = &entry->devpath; in pdcspath_store()
191 if (!entry->ready) { in pdcspath_store()
193 BUG_ON(!entry->dev); in pdcspath_store()
194 device_to_hwpath(entry->dev, (struct hardware_path *)devpath); in pdcspath_store()
199 entry, devpath, entry->addr); in pdcspath_store()
202 if (pdc_stable_write(entry->addr, devpath, sizeof(*devpath)) != PDC_OK) in pdcspath_store()
208 entry->ready = 2; in pdcspath_store()
210 DPRINTK("%s: device: 0x%p\n", __func__, entry->dev); in pdcspath_store()
221 pdcspath_hwpath_read(struct pdcspath_entry *entry, char *buf) in pdcspath_hwpath_read() argument
227 if (!entry || !buf) in pdcspath_hwpath_read()
230 read_lock(&entry->rw_lock); in pdcspath_hwpath_read()
231 devpath = &entry->devpath; in pdcspath_hwpath_read()
232 i = entry->ready; in pdcspath_hwpath_read()
233 read_unlock(&entry->rw_lock); in pdcspath_hwpath_read()
264 pdcspath_hwpath_write(struct pdcspath_entry *entry, const char *buf, size_t count) in pdcspath_hwpath_write() argument
272 if (!entry || !buf || !count) in pdcspath_hwpath_write()
309 "hardware path: %s\n", __func__, entry->name, buf); in pdcspath_hwpath_write()
314 write_lock(&entry->rw_lock); in pdcspath_hwpath_write()
315 entry->ready = 0; in pdcspath_hwpath_write()
316 entry->dev = dev; in pdcspath_hwpath_write()
319 pdcspath_store(entry); in pdcspath_hwpath_write()
322 sysfs_remove_link(&entry->kobj, "device"); in pdcspath_hwpath_write()
323 write_unlock(&entry->rw_lock); in pdcspath_hwpath_write()
325 ret = sysfs_create_link(&entry->kobj, &entry->dev->kobj, "device"); in pdcspath_hwpath_write()
329 entry->name, buf); in pdcspath_hwpath_write()
342 pdcspath_layer_read(struct pdcspath_entry *entry, char *buf) in pdcspath_layer_read() argument
348 if (!entry || !buf) in pdcspath_layer_read()
351 read_lock(&entry->rw_lock); in pdcspath_layer_read()
352 devpath = &entry->devpath; in pdcspath_layer_read()
353 i = entry->ready; in pdcspath_layer_read()
354 read_unlock(&entry->rw_lock); in pdcspath_layer_read()
380 pdcspath_layer_write(struct pdcspath_entry *entry, const char *buf, size_t count) in pdcspath_layer_write() argument
386 if (!entry || !buf || !count) in pdcspath_layer_write()
412 write_lock(&entry->rw_lock); in pdcspath_layer_write()
416 memcpy(&entry->devpath.layers, &layers, sizeof(layers)); in pdcspath_layer_write()
419 pdcspath_store(entry); in pdcspath_layer_write()
420 write_unlock(&entry->rw_lock); in pdcspath_layer_write()
423 entry->name, buf); in pdcspath_layer_write()
437 struct pdcspath_entry *entry = to_pdcspath_entry(kobj); in pdcspath_attr_show() local
442 ret = pdcs_attr->show(entry, buf); in pdcspath_attr_show()
458 struct pdcspath_entry *entry = to_pdcspath_entry(kobj); in pdcspath_attr_store() local
466 ret = pdcs_attr->store(entry, buf, count); in pdcspath_attr_store()
964 struct pdcspath_entry *entry; in pdcs_register_pathentries() local
968 for (i = 0; (entry = pdcspath_entries[i]); i++) in pdcs_register_pathentries()
969 rwlock_init(&entry->rw_lock); in pdcs_register_pathentries()
971 for (i = 0; (entry = pdcspath_entries[i]); i++) { in pdcs_register_pathentries()
972 write_lock(&entry->rw_lock); in pdcs_register_pathentries()
973 err = pdcspath_fetch(entry); in pdcs_register_pathentries()
974 write_unlock(&entry->rw_lock); in pdcs_register_pathentries()
979 entry->kobj.kset = paths_kset; in pdcs_register_pathentries()
980 err = kobject_init_and_add(&entry->kobj, &ktype_pdcspath, NULL, in pdcs_register_pathentries()
981 "%s", entry->name); in pdcs_register_pathentries()
983 kobject_put(&entry->kobj); in pdcs_register_pathentries()
988 write_lock(&entry->rw_lock); in pdcs_register_pathentries()
989 entry->ready = 2; in pdcs_register_pathentries()
990 write_unlock(&entry->rw_lock); in pdcs_register_pathentries()
993 if (entry->dev) { in pdcs_register_pathentries()
994 err = sysfs_create_link(&entry->kobj, &entry->dev->kobj, "device"); in pdcs_register_pathentries()
998 kobject_uevent(&entry->kobj, KOBJ_ADD); in pdcs_register_pathentries()
1011 struct pdcspath_entry *entry; in pdcs_unregister_pathentries() local
1013 for (i = 0; (entry = pdcspath_entries[i]); i++) { in pdcs_unregister_pathentries()
1014 read_lock(&entry->rw_lock); in pdcs_unregister_pathentries()
1015 if (entry->ready >= 2) in pdcs_unregister_pathentries()
1016 kobject_put(&entry->kobj); in pdcs_unregister_pathentries()
1017 read_unlock(&entry->rw_lock); in pdcs_unregister_pathentries()