From b5b5b23cbf2f7632360453e535f3bf71a52a9088 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 2 Oct 2009 16:31:23 -0700 Subject: [PATCH] Use kobject_set_name() for increased portability. As of 2.6.25 kobj->k_name was replaced with kobj->name. Some distros such as RHEL5 (2.6.18) add a patch to prevent this from being a problem but other older distros such as SLES10 (2.6.16) have not. To avoid the whole issue I'm updating the code to use kobject_set_name() which does what I want and has existed all the way back to 2.6.11. --- module/zpios/zpios.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/module/zpios/zpios.c b/module/zpios/zpios.c index ecffb02ac0..f198946d21 100644 --- a/module/zpios/zpios.c +++ b/module/zpios/zpios.c @@ -1223,6 +1223,7 @@ static loff_t zpios_seek(struct file *file, loff_t offset, int origin) return rc; } +static struct cdev zpios_cdev; static struct file_operations zpios_fops = { .owner = THIS_MODULE, .open = zpios_open, @@ -1236,11 +1237,6 @@ static struct file_operations zpios_fops = { .llseek = zpios_seek, }; -static struct cdev zpios_cdev = { - .owner = THIS_MODULE, - .kobj = { .name = ZPIOS_NAME, }, -}; - static int zpios_init(void) { @@ -1253,6 +1249,8 @@ zpios_init(void) /* Support for registering a character driver */ cdev_init(&zpios_cdev, &zpios_fops); + zpios_cdev.owner = THIS_MODULE; + kobject_set_name(&zpios_cdev.kobj, ZPIOS_NAME); if ((rc = cdev_add(&zpios_cdev, dev, ZPIOS_MINORS))) { printk(KERN_ERR "ZPIOS: Error adding cdev, %d\n", rc); kobject_put(&zpios_cdev.kobj);