Commit b7a19c51 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://bk.linux1394.org/ieee1394-2.6

into ppc970.osdl.org:/home/torvalds/v2.5/linux
parents 4c238c91 bf61f9b7
......@@ -2610,24 +2610,32 @@ static void __exit dv1394_exit_module(void)
static int __init dv1394_init_module(void)
{
int ret;
cdev_init(&dv1394_cdev, &dv1394_fops);
dv1394_cdev.owner = THIS_MODULE;
kobject_set_name(&dv1394_cdev.kobj, "dv1394");
if (cdev_add(&dv1394_cdev, IEEE1394_DV1394_DEV, 16)) {
ret = cdev_add(&dv1394_cdev, IEEE1394_DV1394_DEV, 16);
if (ret) {
printk(KERN_ERR "dv1394: unable to register character device\n");
return -EIO;
return ret;
}
devfs_mk_dir("ieee1394/dv");
hpsb_register_highlevel(&dv1394_highlevel);
hpsb_register_protocol(&dv1394_driver);
ret = hpsb_register_protocol(&dv1394_driver);
if (ret) {
printk(KERN_ERR "dv1394: failed to register protocol\n");
hpsb_unregister_highlevel(&dv1394_highlevel);
devfs_remove("ieee1394/dv");
cdev_del(&dv1394_cdev);
return ret;
}
#ifdef CONFIG_COMPAT
{
int ret;
/* First compatible ones */
ret = register_ioctl32_conversion(DV1394_IOC_SHUTDOWN, NULL);
ret |= register_ioctl32_conversion(DV1394_IOC_SUBMIT_FRAMES, NULL);
......
......@@ -1091,27 +1091,14 @@ static int nodemgr_hotplug(struct class_device *cdev, char **envp, int num_envp,
int hpsb_register_protocol(struct hpsb_protocol_driver *driver)
{
driver_register(&driver->driver);
nodemgr_create_drv_files(driver);
int ret;
/*
* Right now registration always succeeds, but maybe we should
* detect clashes in protocols handled by other drivers.
* DRD> No because multiple drivers are needed to handle certain devices.
* For example, a DV camera is an IEC 61883 device (dv1394) and AV/C (raw1394).
* This will become less an issue with libiec61883 using raw1394.
*
* BenC: But can we handle this with an ALLOW_SHARED flag for a
* protocol? When we get an SBP-3 driver, it will be nice if they were
* mutually exclusive, since SBP-3 can handle SBP-2 protocol.
*
* Not to mention that we currently do not seem to support multiple
* drivers claiming the same unitdirectory. If we implement both of
* those, then we'll need to keep probing when a driver claims a
* unitdirectory, but is sharable.
*/
/* This will cause a probe for devices */
ret = driver_register(&driver->driver);
if (!ret)
nodemgr_create_drv_files(driver);
return 0;
return ret;
}
void hpsb_unregister_protocol(struct hpsb_protocol_driver *driver)
......@@ -1247,32 +1234,10 @@ static void nodemgr_node_scan(struct host_info *hi, int generation)
}
static void nodemgr_suspend_ud(struct unit_directory *ud)
{
struct device *dev;
list_for_each_entry(dev, &ud->device.children, node)
nodemgr_suspend_ud(container_of(dev, struct unit_directory, device));
if (ud->device.driver) {
int ret = -1;
if (ud->device.driver->suspend)
ret = ud->device.driver->suspend(&ud->device, 0, 0);
if (ret) {
dev = &ud->device;
down_write(&dev->bus->subsys.rwsem);
device_release_driver(dev);
up_write(&dev->bus->subsys.rwsem);
}
}
}
static void nodemgr_suspend_ne(struct node_entry *ne)
{
struct device *dev;
struct class_device *cdev;
struct unit_directory *ud;
HPSB_DEBUG("Node suspended: ID:BUS[" NODE_BUS_FMT "] GUID[%016Lx]",
NODE_BUS_ARGS(ne->host, ne->nodeid), (unsigned long long)ne->guid);
......@@ -1280,32 +1245,41 @@ static void nodemgr_suspend_ne(struct node_entry *ne)
ne->in_limbo = 1;
device_create_file(&ne->device, &dev_attr_ne_in_limbo);
list_for_each_entry(dev, &ne->device.children, node)
nodemgr_suspend_ud(container_of(dev, struct unit_directory, device));
}
static void nodemgr_resume_ud(struct unit_directory *ud)
{
struct device *dev;
down_write(&ne->device.bus->subsys.rwsem);
list_for_each_entry(cdev, &nodemgr_ud_class.children, node) {
ud = container_of(cdev, struct unit_directory, class_dev);
list_for_each_entry(dev, &ud->device.children, node)
nodemgr_resume_ud(container_of(dev, struct unit_directory, device));
if (ud->ne != ne)
continue;
if (ud->device.driver && ud->device.driver->resume)
ud->device.driver->resume(&ud->device, 0);
if (ud->device.driver &&
(!ud->device.driver->suspend ||
ud->device.driver->suspend(&ud->device, 0, 0)))
device_release_driver(&ud->device);
}
up_write(&ne->device.bus->subsys.rwsem);
}
static void nodemgr_resume_ne(struct node_entry *ne)
{
struct device *dev;
struct class_device *cdev;
struct unit_directory *ud;
ne->in_limbo = 0;
device_remove_file(&ne->device, &dev_attr_ne_in_limbo);
list_for_each_entry(dev, &ne->device.children, node)
nodemgr_resume_ud(container_of(dev, struct unit_directory, device));
down_read(&ne->device.bus->subsys.rwsem);
list_for_each_entry(cdev, &nodemgr_ud_class.children, node) {
ud = container_of(cdev, struct unit_directory, class_dev);
if (ud->ne != ne)
continue;
if (ud->device.driver && ud->device.driver->resume)
ud->device.driver->resume(&ud->device, 0);
}
up_read(&ne->device.bus->subsys.rwsem);
HPSB_DEBUG("Node resumed: ID:BUS[" NODE_BUS_FMT "] GUID[%016Lx]",
NODE_BUS_ARGS(ne->host, ne->nodeid), (unsigned long long)ne->guid);
......
......@@ -2737,6 +2737,8 @@ static struct file_operations raw1394_fops = {
static int __init init_raw1394(void)
{
int ret;
hpsb_register_highlevel(&raw1394_highlevel);
devfs_mk_cdev(MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16),
......@@ -2745,16 +2747,24 @@ static int __init init_raw1394(void)
cdev_init(&raw1394_cdev, &raw1394_fops);
raw1394_cdev.owner = THIS_MODULE;
kobject_set_name(&raw1394_cdev.kobj, RAW1394_DEVICE_NAME);
if (cdev_add(&raw1394_cdev, IEEE1394_RAW1394_DEV, 1)) {
ret = cdev_add(&raw1394_cdev, IEEE1394_RAW1394_DEV, 1);
if (ret) {
HPSB_ERR("raw1394 failed to register minor device block");
devfs_remove(RAW1394_DEVICE_NAME);
hpsb_unregister_highlevel(&raw1394_highlevel);
return -EBUSY;
return ret;
}
printk(KERN_INFO "raw1394: /dev/%s device initialized\n", RAW1394_DEVICE_NAME);
HPSB_INFO("raw1394: /dev/%s device initialized", RAW1394_DEVICE_NAME);
hpsb_register_protocol(&raw1394_driver);
ret = hpsb_register_protocol(&raw1394_driver);
if (ret) {
HPSB_ERR("raw1394: failed to register protocol");
cdev_del(&raw1394_cdev);
devfs_remove(RAW1394_DEVICE_NAME);
hpsb_unregister_highlevel(&raw1394_highlevel);
return ret;
}
return 0;
}
......
......@@ -2801,6 +2801,8 @@ static Scsi_Host_Template scsi_driver_template = {
static int sbp2_module_init(void)
{
int ret;
SBP2_DEBUG("sbp2_module_init");
printk(KERN_INFO "sbp2: %s\n", version);
......@@ -2819,7 +2821,12 @@ static int sbp2_module_init(void)
/* Register our high level driver with 1394 stack */
hpsb_register_highlevel(&sbp2_highlevel);
hpsb_register_protocol(&sbp2_driver);
ret = hpsb_register_protocol(&sbp2_driver);
if (ret) {
SBP2_ERR("Failed to register protocol");
hpsb_unregister_highlevel(&sbp2_highlevel);
return ret;
}
return 0;
}
......
......@@ -1453,24 +1453,32 @@ static void __exit video1394_exit_module (void)
static int __init video1394_init_module (void)
{
int ret;
cdev_init(&video1394_cdev, &video1394_fops);
video1394_cdev.owner = THIS_MODULE;
kobject_set_name(&video1394_cdev.kobj, VIDEO1394_DRIVER_NAME);
ret = cdev_add(&video1394_cdev, IEEE1394_VIDEO1394_DEV, 16);
if (cdev_add(&video1394_cdev, IEEE1394_VIDEO1394_DEV, 16)) {
PRINT_G(KERN_ERR, "video1394: unable to get minor device block");
return -EIO;
return ret;
}
devfs_mk_dir(VIDEO1394_DRIVER_NAME);
hpsb_register_highlevel(&video1394_highlevel);
hpsb_register_protocol(&video1394_driver);
ret = hpsb_register_protocol(&video1394_driver);
if (ret) {
PRINT_G(KERN_ERR, "video1394: failed to register protocol");
hpsb_unregister_highlevel(&video1394_highlevel);
devfs_remove(VIDEO1394_DRIVER_NAME);
cdev_del(&video1394_cdev);
return ret;
}
#ifdef CONFIG_COMPAT
{
int ret;
/* First the compatible ones */
ret = register_ioctl32_conversion(VIDEO1394_IOC_LISTEN_CHANNEL, NULL);
ret |= register_ioctl32_conversion(VIDEO1394_IOC_UNLISTEN_CHANNEL, NULL);
......
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