Commit 854c21cc authored by Ben Collins's avatar Ben Collins

IEEE1394(r1135): Initial ieee1394_host_class implementation.

parent fe8f8d99
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include "csr.h" #include "csr.h"
static void delayed_reset_bus(unsigned long __reset_info) static void delayed_reset_bus(unsigned long __reset_info)
{ {
struct hpsb_host *host = (struct hpsb_host*)__reset_info; struct hpsb_host *host = (struct hpsb_host*)__reset_info;
...@@ -161,7 +160,14 @@ struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra, ...@@ -161,7 +160,14 @@ struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra,
memcpy(&h->device, &nodemgr_dev_template_host, sizeof(h->device)); memcpy(&h->device, &nodemgr_dev_template_host, sizeof(h->device));
h->device.parent = dev; h->device.parent = dev;
snprintf(h->device.bus_id, BUS_ID_SIZE, "fw-host%d", h->id); snprintf(h->device.bus_id, BUS_ID_SIZE, "fw-host%d", h->id);
h->class_dev.dev = &h->device;
h->class_dev.class = &hpsb_host_class;
snprintf(h->class_dev.class_id, BUS_ID_SIZE, "fw-host%d", h->id);
device_register(&h->device); device_register(&h->device);
class_device_register(&h->class_dev);
get_device(&h->device);
return h; return h;
} }
...@@ -178,6 +184,7 @@ void hpsb_remove_host(struct hpsb_host *host) ...@@ -178,6 +184,7 @@ void hpsb_remove_host(struct hpsb_host *host)
highlevel_remove_host(host); highlevel_remove_host(host);
class_device_unregister(&host->class_dev);
device_unregister(&host->device); device_unregister(&host->device);
} }
......
...@@ -61,6 +61,7 @@ struct hpsb_host { ...@@ -61,6 +61,7 @@ struct hpsb_host {
int id; int id;
struct device device; struct device device;
struct class_device class_dev;
int update_config_rom; int update_config_rom;
struct timer_list delayed_reset; struct timer_list delayed_reset;
......
...@@ -1004,6 +1004,7 @@ static int __init ieee1394_init(void) ...@@ -1004,6 +1004,7 @@ static int __init ieee1394_init(void)
bus_register(&ieee1394_bus_type); bus_register(&ieee1394_bus_type);
bus_create_file(&ieee1394_bus_type, &bus_attr_destroy); bus_create_file(&ieee1394_bus_type, &bus_attr_destroy);
class_register(&hpsb_host_class);
if (init_csr()) if (init_csr())
return -ENOMEM; return -ENOMEM;
...@@ -1023,6 +1024,7 @@ static void __exit ieee1394_cleanup(void) ...@@ -1023,6 +1024,7 @@ static void __exit ieee1394_cleanup(void)
cleanup_csr(); cleanup_csr();
class_unregister(&hpsb_host_class);
bus_remove_file(&ieee1394_bus_type, &bus_attr_destroy); bus_remove_file(&ieee1394_bus_type, &bus_attr_destroy);
bus_unregister(&ieee1394_bus_type); bus_unregister(&ieee1394_bus_type);
......
...@@ -215,5 +215,6 @@ static inline unsigned char ieee1394_file_to_instance(struct file *file) ...@@ -215,5 +215,6 @@ static inline unsigned char ieee1394_file_to_instance(struct file *file)
/* Our sysfs bus entry */ /* Our sysfs bus entry */
extern struct bus_type ieee1394_bus_type; extern struct bus_type ieee1394_bus_type;
extern struct class hpsb_host_class;
#endif /* _IEEE1394_CORE_H */ #endif /* _IEEE1394_CORE_H */
...@@ -127,6 +127,16 @@ struct bus_type ieee1394_bus_type = { ...@@ -127,6 +127,16 @@ struct bus_type ieee1394_bus_type = {
.hotplug = nodemgr_hotplug, .hotplug = nodemgr_hotplug,
}; };
static void host_cls_release(struct class_device *class_dev)
{
put_device(&container_of((class_dev), struct hpsb_host, class_dev)->device);
}
struct class hpsb_host_class = {
.name = "ieee1394_host",
.release = host_cls_release,
};
static struct hpsb_highlevel nodemgr_highlevel; static struct hpsb_highlevel nodemgr_highlevel;
static int nodemgr_platform_data_ne; static int nodemgr_platform_data_ne;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment