From 270b5ac2151707c25d3327722c5badfbd95945bc Mon Sep 17 00:00:00 2001 From: David Howells Date: Fri, 12 Apr 2013 02:48:30 +0100 Subject: proc: Add proc_mkdir_data() Add proc_mkdir_data() to allow procfs directories to be created that are annotated at the time of creation with private data rather than doing this post-creation. This means no access is then required to the proc_dir_entry struct to set this. Signed-off-by: David Howells Acked-by: Mauro Carvalho Chehab Acked-by: Greg Kroah-Hartman cc: Neela Syam Kolli cc: Jerry Chuang cc: linux-scsi@vger.kernel.org cc: devel@driverdev.osuosl.org cc: linux-wireless@vger.kernel.org Signed-off-by: Al Viro --- drivers/message/i2o/i2o_proc.c | 8 ++------ drivers/scsi/megaraid.c | 4 ++-- drivers/staging/rtl8192u/r8192U_core.c | 3 +-- 3 files changed, 5 insertions(+), 10 deletions(-) (limited to 'drivers') diff --git a/drivers/message/i2o/i2o_proc.c b/drivers/message/i2o/i2o_proc.c index 70a840f9b283..b7d87cd227a9 100644 --- a/drivers/message/i2o/i2o_proc.c +++ b/drivers/message/i2o/i2o_proc.c @@ -1913,14 +1913,12 @@ static void i2o_proc_device_add(struct proc_dir_entry *dir, osm_debug("adding device /proc/i2o/%s/%s\n", dev->iop->name, buff); - devdir = proc_mkdir(buff, dir); + devdir = proc_mkdir_data(buff, 0, dir, dev); if (!devdir) { osm_warn("Could not allocate procdir!\n"); return; } - devdir->data = dev; - i2o_proc_create_entries(devdir, generic_dev_entries, dev); /* Inform core that we want updates about this device's status */ @@ -1954,12 +1952,10 @@ static int i2o_proc_iop_add(struct proc_dir_entry *dir, osm_debug("adding IOP /proc/i2o/%s\n", c->name); - iopdir = proc_mkdir(c->name, dir); + iopdir = proc_mkdir_data(c->name, 0, dir, c); if (!iopdir) return -1; - iopdir->data = c; - i2o_proc_create_entries(iopdir, i2o_proc_generic_iop_entries, c); list_for_each_entry(dev, &c->devices, list) diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index a1c90bd34e78..ef3384d39e11 100644 --- a/drivers/scsi/megaraid.c +++ b/drivers/scsi/megaraid.c @@ -2818,12 +2818,12 @@ mega_create_proc_entry(int index, struct proc_dir_entry *parent) sprintf(string, "hba%d", adapter->host->host_no); - dir = adapter->controller_proc_dir_entry = proc_mkdir(string, parent); + dir = adapter->controller_proc_dir_entry = + proc_mkdir_data(string, 0, parent, adapter); if(!dir) { printk(KERN_WARNING "\nmegaraid: proc_mkdir failed\n"); return; } - dir->data = adapter; for (f = mega_proc_files; f->name; f++) { de = proc_create_data(f->name, S_IRUSR, dir, &mega_proc_fops, diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 433c3df95de0..d81d7d55f25e 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -672,13 +672,12 @@ void rtl8192_proc_init_one(struct net_device *dev) struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); if (rtl8192_proc) { - priv->dir_dev = proc_mkdir(dev->name, rtl8192_proc); + priv->dir_dev = proc_mkdir_data(dev->name, 0, rtl8192_proc, dev); if (!priv->dir_dev) { RT_TRACE(COMP_ERR, "Unable to initialize /proc/net/rtl8192/%s\n", dev->name); return; } - priv->dir_dev->data = dev; for (f = rtl8192_proc_files; f->name[0]; f++) { if (!proc_create_data(f->name, S_IFREG | S_IRUGO, -- cgit v1.2.3