* [PATCH] firewire: remove driver_data direct access of struct device
@ 2009-05-11 20:18 Roel Kluin
2009-05-11 23:50 ` Stefan Richter
0 siblings, 1 reply; 3+ messages in thread
From: Roel Kluin @ 2009-05-11 20:18 UTC (permalink / raw)
To: krh, linux1394-devel, lkml
To avoid direct access to the driver_data pointer in struct device, the
functions dev_get_drvdata() and dev_set_drvdata() should be used.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c
index 2bcf515..a70e66e 100644
--- a/drivers/firewire/fw-sbp2.c
+++ b/drivers/firewire/fw-sbp2.c
@@ -1125,7 +1125,7 @@ static int sbp2_probe(struct device *dev)
return -ENOMEM;
tgt = (struct sbp2_target *)shost->hostdata;
- unit->device.driver_data = tgt;
+ dev_set_drvdata(&unit->device, tgt);
tgt->unit = unit;
kref_init(&tgt->kref);
INIT_LIST_HEAD(&tgt->lu_list);
@@ -1180,7 +1180,7 @@ static int sbp2_probe(struct device *dev)
static int sbp2_remove(struct device *dev)
{
struct fw_unit *unit = fw_unit(dev);
- struct sbp2_target *tgt = unit->device.driver_data;
+ struct sbp2_target *tgt = dev_get_drvdata(&unit->device);
sbp2_target_put(tgt);
return 0;
@@ -1240,7 +1240,7 @@ static void sbp2_reconnect(struct work_struct *work)
static void sbp2_update(struct fw_unit *unit)
{
- struct sbp2_target *tgt = unit->device.driver_data;
+ struct sbp2_target *tgt = dev_get_drvdata(&unit->device);
struct sbp2_logical_unit *lu;
fw_device_enable_phys_dma(fw_device(unit->device.parent));
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] firewire: remove driver_data direct access of struct device
2009-05-11 20:18 [PATCH] firewire: remove driver_data direct access of struct device Roel Kluin
@ 2009-05-11 23:50 ` Stefan Richter
2009-05-12 16:43 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Richter @ 2009-05-11 23:50 UTC (permalink / raw)
To: Roel Kluin, Greg Kroah-Hartman; +Cc: krh, linux1394-devel, lkml
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.
>
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Greg has this already in his driver core tree.
BTW Greg, just in case, the patches
"firewire: remove driver_data direct access of struct device" and
"ieee1394: remove driver_data direct access of struct device"
which you posted on April 30 are
Acked-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
> ---
> diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c
> index 2bcf515..a70e66e 100644
> --- a/drivers/firewire/fw-sbp2.c
> +++ b/drivers/firewire/fw-sbp2.c
> @@ -1125,7 +1125,7 @@ static int sbp2_probe(struct device *dev)
> return -ENOMEM;
>
> tgt = (struct sbp2_target *)shost->hostdata;
> - unit->device.driver_data = tgt;
> + dev_set_drvdata(&unit->device, tgt);
> tgt->unit = unit;
> kref_init(&tgt->kref);
> INIT_LIST_HEAD(&tgt->lu_list);
> @@ -1180,7 +1180,7 @@ static int sbp2_probe(struct device *dev)
> static int sbp2_remove(struct device *dev)
> {
> struct fw_unit *unit = fw_unit(dev);
> - struct sbp2_target *tgt = unit->device.driver_data;
> + struct sbp2_target *tgt = dev_get_drvdata(&unit->device);
>
> sbp2_target_put(tgt);
> return 0;
> @@ -1240,7 +1240,7 @@ static void sbp2_reconnect(struct work_struct *work)
>
> static void sbp2_update(struct fw_unit *unit)
> {
> - struct sbp2_target *tgt = unit->device.driver_data;
> + struct sbp2_target *tgt = dev_get_drvdata(&unit->device);
> struct sbp2_logical_unit *lu;
>
> fw_device_enable_phys_dma(fw_device(unit->device.parent));
--
Stefan Richter
-=====-=-=== -=-= -==-=
http://arcgraph.de/sr/
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] firewire: remove driver_data direct access of struct device
2009-05-11 23:50 ` Stefan Richter
@ 2009-05-12 16:43 ` Greg KH
0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2009-05-12 16:43 UTC (permalink / raw)
To: Stefan Richter; +Cc: Roel Kluin, Greg Kroah-Hartman, krh, linux1394-devel, lkml
On Tue, May 12, 2009 at 01:50:05AM +0200, Stefan Richter wrote:
> 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.
> >
> > Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
>
> Greg has this already in his driver core tree.
>
> BTW Greg, just in case, the patches
> "firewire: remove driver_data direct access of struct device" and
> "ieee1394: remove driver_data direct access of struct device"
> which you posted on April 30 are
> Acked-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Thanks, I've added your acks to the patches.
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-05-12 17:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-11 20:18 [PATCH] firewire: remove driver_data direct access of struct device Roel Kluin
2009-05-11 23:50 ` Stefan Richter
2009-05-12 16:43 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox