From: Greg Kroah-Hartman <gregkh@suse.de>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Subject: [PATCH 12/75] kobjects: fix up improper use of the kobject name field
Date: Fri, 12 Oct 2007 15:16:16 -0700 [thread overview]
Message-ID: <11922274941588-git-send-email-gregkh@suse.de> (raw)
In-Reply-To: <11922274901810-git-send-email-gregkh@suse.de>
A number of different drivers incorrect access the kobject name field
directly. This is not correct as the name might not be in the array.
Use the proper accessor function instead.
---
block/elevator.c | 2 +-
block/ll_rw_blk.c | 2 +-
drivers/acpi/bus.c | 2 +-
drivers/cpufreq/cpufreq.c | 2 +-
drivers/md/md.c | 3 +--
drivers/net/ibmveth.c | 2 +-
drivers/pci/setup-irq.c | 2 +-
fs/partitions/check.c | 12 +++++++-----
fs/sysfs/dir.c | 2 +-
net/bridge/br_sysfs_br.c | 2 +-
10 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/block/elevator.c b/block/elevator.c
index c6d153d..b9c518a 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -186,7 +186,7 @@ static elevator_t *elevator_alloc(struct request_queue *q,
eq->ops = &e->ops;
eq->elevator_type = e;
kobject_init(&eq->kobj);
- snprintf(eq->kobj.name, KOBJ_NAME_LEN, "%s", "iosched");
+ kobject_set_name(&eq->kobj, "%s", "iosched");
eq->kobj.ktype = &elv_ktype;
mutex_init(&eq->sysfs_lock);
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index cd9d2c5..d875673 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -1854,7 +1854,7 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)
init_timer(&q->unplug_timer);
- snprintf(q->kobj.name, KOBJ_NAME_LEN, "%s", "queue");
+ kobject_set_name(&q->kobj, "%s", "queue");
q->kobj.ktype = &queue_ktype;
kobject_init(&q->kobj);
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index feab124..cbfc815 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -194,7 +194,7 @@ int acpi_bus_set_power(acpi_handle handle, int state)
if (!device->flags.power_manageable) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device `[%s]' is not power manageable\n",
- device->dev.kobj.name));
+ kobject_name(&device->dev.kobj)));
return -ENODEV;
}
/*
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 2f6a73c..2ce3de5 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -828,7 +828,7 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
/* prepare interface data */
policy->kobj.parent = &sys_dev->kobj;
policy->kobj.ktype = &ktype_cpufreq;
- strlcpy(policy->kobj.name, "cpufreq", KOBJ_NAME_LEN);
+ kobject_set_name(&policy->kobj, "cpufreq");
ret = kobject_register(&policy->kobj);
if (ret) {
diff --git a/drivers/md/md.c b/drivers/md/md.c
index e8f102e..acf1b81 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -3076,8 +3076,7 @@ static struct kobject *md_probe(dev_t dev, int *part, void *data)
mddev->gendisk = disk;
mutex_unlock(&disks_mutex);
mddev->kobj.parent = &disk->kobj;
- mddev->kobj.k_name = NULL;
- snprintf(mddev->kobj.name, KOBJ_NAME_LEN, "%s", "md");
+ kobject_set_name(&mddev->kobj, "%s", "md");
mddev->kobj.ktype = &md_ktype;
if (kobject_register(&mddev->kobj))
printk(KERN_WARNING "md: cannot register %s/md - name in use\n",
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c
index 4ac161e..7d7758f 100644
--- a/drivers/net/ibmveth.c
+++ b/drivers/net/ibmveth.c
@@ -1183,7 +1183,7 @@ static int __devinit ibmveth_probe(struct vio_dev *dev, const struct vio_device_
pool_count[i], pool_size[i],
pool_active[i]);
kobj->parent = &dev->dev.kobj;
- sprintf(kobj->name, "pool%d", i);
+ kobject_set_name(kobj, "pool%d", i);
kobj->ktype = &ktype_veth_pool;
kobject_register(kobj);
}
diff --git a/drivers/pci/setup-irq.c b/drivers/pci/setup-irq.c
index 568f187..05ca2ed 100644
--- a/drivers/pci/setup-irq.c
+++ b/drivers/pci/setup-irq.c
@@ -48,7 +48,7 @@ pdev_fixup_irq(struct pci_dev *dev,
dev->irq = irq;
pr_debug("PCI: fixup irq: (%s) got %d\n",
- dev->dev.kobj.name, dev->irq);
+ kobject_name(&dev->dev.kobj), dev->irq);
/* Always tell the device, so the driver knows what is
the real IRQ to use; the device does not use it. */
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index 783c57e..722e12e 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -381,10 +381,12 @@ void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len,
p->partno = part;
p->policy = disk->policy;
- if (isdigit(disk->kobj.name[strlen(disk->kobj.name)-1]))
- snprintf(p->kobj.name,KOBJ_NAME_LEN,"%sp%d",disk->kobj.name,part);
+ if (isdigit(disk->kobj.k_name[strlen(disk->kobj.k_name)-1]))
+ kobject_set_name(&p->kobj, "%sp%d",
+ kobject_name(&disk->kobj), part);
else
- snprintf(p->kobj.name,KOBJ_NAME_LEN,"%s%d",disk->kobj.name,part);
+ kobject_set_name(&p->kobj, "%s%d",
+ kobject_name(&disk->kobj),part);
p->kobj.parent = &disk->kobj;
p->kobj.ktype = &ktype_part;
kobject_init(&p->kobj);
@@ -477,9 +479,9 @@ void register_disk(struct gendisk *disk)
struct hd_struct *p;
int err;
- strlcpy(disk->kobj.name,disk->disk_name,KOBJ_NAME_LEN);
+ kobject_set_name(&disk->kobj, "%s", disk->disk_name);
/* ewww... some of these buggers have / in name... */
- s = strchr(disk->kobj.name, '/');
+ s = strchr(disk->kobj.k_name, '/');
if (s)
*s = '!';
if ((err = kobject_add(&disk->kobj)))
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index 83e76b3..ea33b66 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -1013,7 +1013,7 @@ again:
goto again;
}
- new_dentry = lookup_one_len(kobj->name, new_parent, strlen(kobj->name));
+ new_dentry = lookup_one_len(kobject_name(kobj), new_parent, strlen(kobject_name(kobj)));
if (IS_ERR(new_dentry)) {
error = PTR_ERR(new_dentry);
goto out_unlock;
diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c
index c65f54e..3312e8f 100644
--- a/net/bridge/br_sysfs_br.c
+++ b/net/bridge/br_sysfs_br.c
@@ -435,7 +435,7 @@ int br_sysfs_addbr(struct net_device *dev)
err = kobject_register(&br->ifobj);
if (err) {
pr_info("%s: can't add kobject (directory) %s/%s\n",
- __FUNCTION__, dev->name, br->ifobj.name);
+ __FUNCTION__, dev->name, kobject_name(&br->ifobj));
goto out3;
}
return 0;
--
1.5.3.4
next prev parent reply other threads:[~2007-10-12 22:24 UTC|newest]
Thread overview: 75+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20071012221251.GB4559@kroah.com\>
2007-10-12 22:16 ` [PATCH 01/75] platform: prefix MODALIAS with "platform:" Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 02/75] HOWTO: update ja_JP/HOWTO with latest changes Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 03/75] Driver core: make sysfs uevent-attributes static Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 04/75] Driver core: change add_uevent_var to use a struct Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 05/75] Driver core: add CONFIG_UEVENT_HELPER_PATH Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 06/75] Driver core: remove subsys_set_kset Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 07/75] Driver core: remove kset_set_kset_s Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 08/75] Driver core: remove subsys_put() Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 09/75] Driver core: remove subsys_get() Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 10/75] Driver core: remove put_bus() Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 11/75] Driver core: remove get_bus() Greg Kroah-Hartman
2007-10-12 22:16 ` Greg Kroah-Hartman [this message]
2007-10-12 22:16 ` [PATCH 13/75] cdev: remove unneeded setting of cdev names Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 14/75] Drivers: clean up direct setting of the name of a kset Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 15/75] kobject: remove the static array for the name Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 16/75] Driver core: clean up removed functions from the documentation Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 17/75] debugfs: helper for decimal challenged Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 18/75] sysfs/file.c - use mutex instead of semaphore Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 19/75] sysfs: cleanup semaphore.h Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 20/75] sysfs: Remove first pass at shadow directory support Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 21/75] sysfs: cosmetic changes in sysfs_lookup() Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 22/75] sysfs: simplify sysfs_rename_dir() Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 23/75] sysfs: make sysfs_add/remove_one() call link/unlink_sibling() implictly Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 24/75] sysfs: make sysfs_add_one() automatically check for duplicate entry Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 25/75] sysfs: make sysfs_addrm_finish() return void Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 26/75] dmi-id: Use dynamic sysfs attributes Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 27/75] dmi-id: Possible cleanup Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 28/75] Convert from class_device to device for drivers/video Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 29/75] Convert from class_device to device in drivers/char Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 30/75] Driver core: exclude kobject_uevent.c for !CONFIG_HOTPLUG Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 31/75] Driver core: add uevent file for bus and driver Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 32/75] Driver core: kerneldoc - kobject_uevent_env is not "usually KOBJ_MOVE" Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 33/75] Fix Firmware class name collision Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 34/75] drivers/base/power/: make 2 functions static Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 35/75] sysfs: Fix typos in fs/sysfs/file.c Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 36/75] sysdev: remove global sysdev drivers list Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 37/75] Driver core: Make platform_device.id an int Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 38/75] sysfs: fix i_mutex locking in sysfs_get_dentry() Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 39/75] sysfs: Move all of inode initialization into sysfs_init_inode Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 40/75] sysfs: Remove sysfs_instantiate Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 41/75] sysfs: Use kill_anon_super Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 42/75] sysfs: Make sysfs_mount static Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 43/75] sysfs: In sysfs_lookup don't open code sysfs_find_dirent Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 44/75] sysfs: Simplify readdir Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 45/75] sysfs: Rewrite sysfs_drop_dentry Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 46/75] sysfs: Introduce sysfs_rename_mutex Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 47/75] sysfs: simply sysfs_get_dentry Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 48/75] sysfs: Remove s_dentry Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 49/75] sysfs: Rewrite rename in terms of sysfs dirents Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 50/75] sysfs: Rewrite sysfs_move_dir " Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 51/75] PTY: add kernel parameter to overwrite legacy pty count Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 52/75] sysfs: spit a warning to users when they try to create a duplicate sysfs file Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 53/75] sysfs: fix comments of sysfs_add/remove_one() Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 54/75] sysfs: fix sysfs_chmod_file() such that it updates sd->s_mode too Greg Kroah-Hartman
2007-10-12 22:16 ` [PATCH 55/75] sysfs: clean up header files Greg Kroah-Hartman
2007-10-12 22:17 ` [PATCH 56/75] sysfs: kill sysfs_update_file() Greg Kroah-Hartman
2007-10-12 22:17 ` [PATCH 57/75] sysfs: reposition sysfs_dirent->s_mode Greg Kroah-Hartman
2007-10-12 22:17 ` [PATCH 58/75] sysfs: kill unnecessary sysfs_get() in open paths Greg Kroah-Hartman
2007-10-12 22:17 ` [PATCH 59/75] sysfs: kill unnecessary NULL pointer check in sysfs_release() Greg Kroah-Hartman
2007-10-12 22:17 ` [PATCH 60/75] sysfs: make bin attr open get active reference of parent too Greg Kroah-Hartman
2007-10-12 22:17 ` [PATCH 61/75] sysfs: make s_elem an anonymous union Greg Kroah-Hartman
2007-10-12 22:17 ` [PATCH 62/75] sysfs: open code sysfs_attach_dentry() Greg Kroah-Hartman
2007-10-12 22:17 ` [PATCH 63/75] sysfs: make sysfs_root a regular directory dirent Greg Kroah-Hartman
2007-10-12 22:17 ` [PATCH 64/75] sysfs: move sysfs_dirent->s_children into sysfs_dirent->s_dir Greg Kroah-Hartman
2007-10-12 22:17 ` [PATCH 65/75] sysfs: implement sysfs_open_dirent Greg Kroah-Hartman
2007-10-12 22:17 ` [PATCH 66/75] sysfs: move sysfs file poll implementation to sysfs_open_dirent Greg Kroah-Hartman
2007-10-12 22:17 ` [PATCH 67/75] driver core: remove subsystem_init() Greg Kroah-Hartman
2007-10-12 22:17 ` [PATCH 68/75] Driver core: rename ktype_class Greg Kroah-Hartman
2007-10-12 22:17 ` [PATCH 69/75] Driver core: rename ktype_device Greg Kroah-Hartman
2007-10-12 22:17 ` [PATCH 70/75] Driver core: rename ktype_driver Greg Kroah-Hartman
2007-10-12 22:17 ` [PATCH 71/75] Driver core: rename ktype_edd and ktype_efivar Greg Kroah-Hartman
2007-10-12 22:17 ` [PATCH 72/75] kset: add some kerneldoc to help describe what these strange things are Greg Kroah-Hartman
2007-10-12 22:17 ` [PATCH 73/75] kobject: update the copyrights Greg Kroah-Hartman
2007-10-12 22:17 ` [PATCH 74/75] sysfs: add copyrights Greg Kroah-Hartman
2007-10-12 22:17 ` [PATCH 75/75] PM: merge device power-management source files Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11922274941588-git-send-email-gregkh@suse.de \
--to=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox