From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Cc: Jonathan Corbet <corbet@lwn.net>, Jean Delvare <jdelvare@suse.de>,
Wolfram Sang <wsa@the-dreams.de>,
Willy Tarreau <willy@meta-x.org>,
One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>,
dan.carpenter@oracle.com, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org,
devel@driverdev.osuosl.org
Subject: Re: [PATCH 1/4] parport: modify parport subsystem to use devicemodel
Date: Wed, 15 Apr 2015 15:23:27 +0200 [thread overview]
Message-ID: <20150415132327.GE21491@kroah.com> (raw)
In-Reply-To: <1429084124-2271-2-git-send-email-sudipm.mukherjee@gmail.com>
On Wed, Apr 15, 2015 at 01:18:41PM +0530, Sudip Mukherjee wrote:
> parport starts using device-model and we now have parport under
> /sys/bus. As the ports are discovered they are added as device under
> /sys/bus/parport. As and when other drivers register new device,
> they will be registered as a subdevice under the relevant parport.
>
> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> ---
> drivers/parport/procfs.c | 15 ++-
> drivers/parport/share.c | 236 ++++++++++++++++++++++++++++++++++++++++++++---
> include/linux/parport.h | 29 +++++-
> 3 files changed, 267 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/parport/procfs.c b/drivers/parport/procfs.c
> index 3b47080..1ce363b 100644
> --- a/drivers/parport/procfs.c
> +++ b/drivers/parport/procfs.c
> @@ -21,6 +21,7 @@
> #include <linux/parport.h>
> #include <linux/ctype.h>
> #include <linux/sysctl.h>
> +#include <linux/device.h>
>
> #include <asm/uaccess.h>
>
> @@ -558,8 +559,18 @@ int parport_device_proc_unregister(struct pardevice *device)
>
> static int __init parport_default_proc_register(void)
> {
> + int ret;
> +
> parport_default_sysctl_table.sysctl_header =
> register_sysctl_table(parport_default_sysctl_table.dev_dir);
> + if (!parport_default_sysctl_table.sysctl_header)
> + return -ENOMEM;
> + ret = bus_register(&parport_bus_type);
> + if (ret) {
> + unregister_sysctl_table(parport_default_sysctl_table.
> + sysctl_header);
> + return ret;
> + }
> return 0;
> }
>
> @@ -570,6 +581,7 @@ static void __exit parport_default_proc_unregister(void)
> sysctl_header);
> parport_default_sysctl_table.sysctl_header = NULL;
> }
> + bus_unregister(&parport_bus_type);
> }
>
> #else /* no sysctl or no procfs*/
> @@ -596,11 +608,12 @@ int parport_device_proc_unregister(struct pardevice *device)
>
> static int __init parport_default_proc_register (void)
> {
> - return 0;
> + return bus_register(&parport_bus_type);
> }
>
> static void __exit parport_default_proc_unregister (void)
> {
> + bus_unregister(&parport_bus_type);
> }
> #endif
Don't bury bus register/unregister down in proc file creation, it's hard
to review and justify.
greg k-h
next prev parent reply other threads:[~2015-04-15 13:23 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-15 7:48 [PATCH 0/4] convert parport to device-model Sudip Mukherjee
2015-04-15 7:48 ` [PATCH 1/4] parport: modify parport subsystem to use devicemodel Sudip Mukherjee
2015-04-15 8:27 ` Dan Carpenter
2015-04-15 9:20 ` Sudip Mukherjee
2015-04-15 9:32 ` Dan Carpenter
2015-04-15 9:45 ` Dan Carpenter
2015-04-15 10:28 ` Sudip Mukherjee
2015-04-15 8:33 ` Dan Carpenter
2015-04-15 9:24 ` Sudip Mukherjee
2015-04-15 13:23 ` Greg Kroah-Hartman [this message]
2015-04-15 13:23 ` Greg Kroah-Hartman
2015-04-15 13:31 ` Greg Kroah-Hartman
2015-04-15 16:13 ` Sudip Mukherjee
2015-04-16 9:50 ` Sudip Mukherjee
2015-04-15 7:48 ` [PATCH 2/4] parport: update TODO and documentation Sudip Mukherjee
2015-04-15 7:48 ` [PATCH 3/4] i2c-parport: use device-model parport Sudip Mukherjee
2015-04-15 7:48 ` [PATCH 4/4] staging: panel: use parport in device-model Sudip Mukherjee
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=20150415132327.GE21491@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=corbet@lwn.net \
--cc=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=gnomes@lxorguk.ukuu.org.uk \
--cc=jdelvare@suse.de \
--cc=linux-doc@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sudipm.mukherjee@gmail.com \
--cc=willy@meta-x.org \
--cc=wsa@the-dreams.de \
/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