[PATCH] st: set owner in struct device_driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



After moving from from branch next-20141106 to next-20141111 to pick up recent changes to the st driver I found that the following message was being logged by the kernel (for many other modules as well):

Driver 'st' needs an owner

There was a change in driver_register to check the struct module *owner and if it's not set complain about it, the code path for the st driver is:

static int __init init_st(void)
{
...
        err = scsi_register_driver(&st_template.gendrv);

Which calls:

int scsi_register_driver(struct device_driver *drv)
{
        drv->bus = &scsi_bus_type;

        return driver_register(drv);
}
EXPORT_SYMBOL(scsi_register_driver);

Which calls:

int driver_register(struct device_driver *drv)
{
        int ret;
        struct device_driver *other;

        BUG_ON(!drv->bus->p);

        if (!drv->owner)
                printk(KERN_WARNING "Driver '%s' needs an owner", drv->name);
...

This patch sets the owner field in the struct device_driver contained in the struct scsi_driver for this module. Tested with kernel version 3.18.0-rc4-next-20141111. My assumption here is that the check added in driver_register() is correct and that forces this change and there's a lot of other modules that require a similar change (at least 72 including sd, sr, and osst).

Signed-off-by: Shane Seymour <shane.seymour@xxxxxx>
---
diff -up a/drivers/scsi/st.c b/drivers/scsi/st.c
--- a/drivers/scsi/st.c	2014-11-10 21:23:27.088567337 -0600
+++ b/drivers/scsi/st.c	2014-11-11 14:07:37.312721375 -0600
@@ -207,6 +207,7 @@ static struct scsi_driver st_template =
 		.name		= "st",
 		.probe		= st_probe,
 		.remove		= st_remove,
+		.owner		= THIS_MODULE,
 	},
 };
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux