From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Roel Kluin <roel.kluin@gmail.com>
Cc: virtualization@lists.osdl.org, xen-devel@lists.xensource.com,
Greg KH <gregkh@suse.de>,
jeremy@xensource.com, lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] xen/blkfront: remove driver_data direct access of struct device
Date: Mon, 11 May 2009 14:02:31 -0700 [thread overview]
Message-ID: <4A089267.9090409@goop.org> (raw)
In-Reply-To: <4A087630.30802@gmail.com>
Roel Kluin wrote:
> To avoid direct access to the driver_data pointer in struct device, the
> functions dev_get_drvdata() and dev_set_drvdata() should be used.
>
Are these the same as the ones Greg KH posted last week?
J
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
> index 8f90508..ff09809 100644
> --- a/drivers/block/xen-blkfront.c
> +++ b/drivers/block/xen-blkfront.c
> @@ -755,12 +755,12 @@ static int blkfront_probe(struct xenbus_device *dev,
>
> /* Front end dir is a number, which is used as the id. */
> info->handle = simple_strtoul(strrchr(dev->nodename, '/')+1, NULL, 0);
> - dev->dev.driver_data = info;
> + dev_set_drvdata(&dev->dev, info);
>
> err = talk_to_backend(dev, info);
> if (err) {
> kfree(info);
> - dev->dev.driver_data = NULL;
> + dev_set_drvdata(&dev->dev, NULL);
> return err;
> }
>
> @@ -845,7 +845,7 @@ static int blkif_recover(struct blkfront_info *info)
> */
> static int blkfront_resume(struct xenbus_device *dev)
> {
> - struct blkfront_info *info = dev->dev.driver_data;
> + struct blkfront_info *info = dev_get_drvdata(&dev->dev);
> int err;
>
> dev_dbg(&dev->dev, "blkfront_resume: %s\n", dev->nodename);
> @@ -924,7 +924,7 @@ static void blkfront_connect(struct blkfront_info *info)
> */
> static void blkfront_closing(struct xenbus_device *dev)
> {
> - struct blkfront_info *info = dev->dev.driver_data;
> + struct blkfront_info *info = dev_get_drvdata(&dev->dev);
> unsigned long flags;
>
> dev_dbg(&dev->dev, "blkfront_closing: %s removed\n", dev->nodename);
> @@ -959,7 +959,7 @@ static void blkfront_closing(struct xenbus_device *dev)
> static void backend_changed(struct xenbus_device *dev,
> enum xenbus_state backend_state)
> {
> - struct blkfront_info *info = dev->dev.driver_data;
> + struct blkfront_info *info = dev_get_drvdata(&dev->dev);
> struct block_device *bd;
>
> dev_dbg(&dev->dev, "blkfront:backend_changed.\n");
> @@ -997,7 +997,7 @@ static void backend_changed(struct xenbus_device *dev,
>
> static int blkfront_remove(struct xenbus_device *dev)
> {
> - struct blkfront_info *info = dev->dev.driver_data;
> + struct blkfront_info *info = dev_get_drvdata(&dev->dev);
>
> dev_dbg(&dev->dev, "blkfront_remove: %s removed\n", dev->nodename);
>
> @@ -1010,7 +1010,7 @@ static int blkfront_remove(struct xenbus_device *dev)
>
> static int blkfront_is_ready(struct xenbus_device *dev)
> {
> - struct blkfront_info *info = dev->dev.driver_data;
> + struct blkfront_info *info = dev_get_drvdata(&dev->dev);
>
> return info->is_ready;
> }
> _______________________________________________
> Virtualization mailing list
> Virtualization@lists.linux-foundation.org
> https://lists.linux-foundation.org/mailman/listinfo/virtualization
>
WARNING: multiple messages have this Message-ID (diff)
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Roel Kluin <roel.kluin@gmail.com>
Cc: jeremy@xensource.com, virtualization@lists.osdl.org,
xen-devel@lists.xensource.com,
lkml <linux-kernel@vger.kernel.org>, Greg KH <gregkh@suse.de>
Subject: Re: [PATCH] xen/blkfront: remove driver_data direct access of struct device
Date: Mon, 11 May 2009 14:02:31 -0700 [thread overview]
Message-ID: <4A089267.9090409@goop.org> (raw)
In-Reply-To: <4A087630.30802@gmail.com>
Roel Kluin wrote:
> To avoid direct access to the driver_data pointer in struct device, the
> functions dev_get_drvdata() and dev_set_drvdata() should be used.
>
Are these the same as the ones Greg KH posted last week?
J
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
> index 8f90508..ff09809 100644
> --- a/drivers/block/xen-blkfront.c
> +++ b/drivers/block/xen-blkfront.c
> @@ -755,12 +755,12 @@ static int blkfront_probe(struct xenbus_device *dev,
>
> /* Front end dir is a number, which is used as the id. */
> info->handle = simple_strtoul(strrchr(dev->nodename, '/')+1, NULL, 0);
> - dev->dev.driver_data = info;
> + dev_set_drvdata(&dev->dev, info);
>
> err = talk_to_backend(dev, info);
> if (err) {
> kfree(info);
> - dev->dev.driver_data = NULL;
> + dev_set_drvdata(&dev->dev, NULL);
> return err;
> }
>
> @@ -845,7 +845,7 @@ static int blkif_recover(struct blkfront_info *info)
> */
> static int blkfront_resume(struct xenbus_device *dev)
> {
> - struct blkfront_info *info = dev->dev.driver_data;
> + struct blkfront_info *info = dev_get_drvdata(&dev->dev);
> int err;
>
> dev_dbg(&dev->dev, "blkfront_resume: %s\n", dev->nodename);
> @@ -924,7 +924,7 @@ static void blkfront_connect(struct blkfront_info *info)
> */
> static void blkfront_closing(struct xenbus_device *dev)
> {
> - struct blkfront_info *info = dev->dev.driver_data;
> + struct blkfront_info *info = dev_get_drvdata(&dev->dev);
> unsigned long flags;
>
> dev_dbg(&dev->dev, "blkfront_closing: %s removed\n", dev->nodename);
> @@ -959,7 +959,7 @@ static void blkfront_closing(struct xenbus_device *dev)
> static void backend_changed(struct xenbus_device *dev,
> enum xenbus_state backend_state)
> {
> - struct blkfront_info *info = dev->dev.driver_data;
> + struct blkfront_info *info = dev_get_drvdata(&dev->dev);
> struct block_device *bd;
>
> dev_dbg(&dev->dev, "blkfront:backend_changed.\n");
> @@ -997,7 +997,7 @@ static void backend_changed(struct xenbus_device *dev,
>
> static int blkfront_remove(struct xenbus_device *dev)
> {
> - struct blkfront_info *info = dev->dev.driver_data;
> + struct blkfront_info *info = dev_get_drvdata(&dev->dev);
>
> dev_dbg(&dev->dev, "blkfront_remove: %s removed\n", dev->nodename);
>
> @@ -1010,7 +1010,7 @@ static int blkfront_remove(struct xenbus_device *dev)
>
> static int blkfront_is_ready(struct xenbus_device *dev)
> {
> - struct blkfront_info *info = dev->dev.driver_data;
> + struct blkfront_info *info = dev_get_drvdata(&dev->dev);
>
> return info->is_ready;
> }
> _______________________________________________
> Virtualization mailing list
> Virtualization@lists.linux-foundation.org
> https://lists.linux-foundation.org/mailman/listinfo/virtualization
>
next prev parent reply other threads:[~2009-05-11 21:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-11 19:02 [PATCH] xen/blkfront: remove driver_data direct access of struct device Roel Kluin
2009-05-11 21:02 ` Jeremy Fitzhardinge [this message]
2009-05-11 21:02 ` Jeremy Fitzhardinge
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=4A089267.9090409@goop.org \
--to=jeremy@goop.org \
--cc=gregkh@suse.de \
--cc=jeremy@xensource.com \
--cc=linux-kernel@vger.kernel.org \
--cc=roel.kluin@gmail.com \
--cc=virtualization@lists.osdl.org \
--cc=xen-devel@lists.xensource.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.