From: Greg KH <greg@kroah.com>
To: "Seymour, Shane M" <shane.seymour@hp.com>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
"Kai.Makisara@kolumbus.fi" <Kai.Makisara@kolumbus.fi>,
"linux-api@vger.kernel.org" <linux-api@vger.kernel.org>
Subject: Re: [PATCH] st: convert to using driver attr groups for sysfs
Date: Tue, 23 Jun 2015 19:37:55 -0700 [thread overview]
Message-ID: <20150624023755.GB18357@kroah.com> (raw)
In-Reply-To: <DDB9C85B850785449757F9914A034FCB3BFF68D9@G9W0766.americas.hpqcorp.net>
On Tue, Jun 23, 2015 at 08:11:00AM +0000, Seymour, Shane M wrote:
> This patch changes the st driver to use attribute groups so
> driver sysfs files are created automatically. See the
> following for reference:
>
> http://kroah.com/log/blog/2013/06/26/how-to-create-a-sysfs-file-correctly/
>
> Signed-off-by: Shane Seymour <shane.seymour@hp.com>
Very nice, thanks for doing this.
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> --- a/drivers/scsi/st.c 2015-06-22 14:20:40.829612661 -0500
> +++ b/drivers/scsi/st.c 2015-06-22 15:49:49.357248393 -0500
> @@ -85,6 +85,7 @@ static int debug_flag;
>
> static struct class st_sysfs_class;
> static const struct attribute_group *st_dev_groups[];
> +static const struct attribute_group *st_drv_groups[];
>
> MODULE_AUTHOR("Kai Makisara");
> MODULE_DESCRIPTION("SCSI tape (st) driver");
> @@ -198,15 +199,13 @@ static int sgl_unmap_user_pages(struct s
> static int st_probe(struct device *);
> static int st_remove(struct device *);
>
> -static int do_create_sysfs_files(void);
> -static void do_remove_sysfs_files(void);
> -
> static struct scsi_driver st_template = {
> .gendrv = {
> .name = "st",
> .owner = THIS_MODULE,
> .probe = st_probe,
> .remove = st_remove,
> + .groups = st_drv_groups,
> },
> };
>
> @@ -4404,14 +4403,8 @@ static int __init init_st(void)
> if (err)
> goto err_chrdev;
>
> - err = do_create_sysfs_files();
> - if (err)
> - goto err_scsidrv;
> -
> return 0;
>
> -err_scsidrv:
> - scsi_unregister_driver(&st_template.gendrv);
> err_chrdev:
> unregister_chrdev_region(MKDEV(SCSI_TAPE_MAJOR, 0),
> ST_MAX_TAPE_ENTRIES);
> @@ -4422,7 +4415,6 @@ err_class:
>
> static void __exit exit_st(void)
> {
> - do_remove_sysfs_files();
> scsi_unregister_driver(&st_template.gendrv);
> unregister_chrdev_region(MKDEV(SCSI_TAPE_MAJOR, 0),
> ST_MAX_TAPE_ENTRIES);
> @@ -4459,44 +4451,14 @@ static ssize_t st_version_show(struct de
> }
> static DRIVER_ATTR(version, S_IRUGO, st_version_show, NULL);
For a future patch, you might want to convert these type of declarations
to use DRIVER_ATTR_RO() and friends.
thanks,
greg k-h
next prev parent reply other threads:[~2015-06-24 2:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-23 8:11 [PATCH] st: convert to using driver attr groups for sysfs Seymour, Shane M
2015-06-24 2:37 ` Greg KH [this message]
2015-06-24 20:19 ` "Kai Mäkisara (Kolumbus)"
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=20150624023755.GB18357@kroah.com \
--to=greg@kroah.com \
--cc=Kai.Makisara@kolumbus.fi \
--cc=linux-api@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=shane.seymour@hp.com \
/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