Skip to contentSkip to conversation

firewire: remove driver_data direct access of struct device

PATCH In review Roel Kluin 3 participants 3 messages May 11, 2009 – May 12, 2009 Firewire

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 firewire: remove driver_data direct access of struct device

To avoid direct access to the driver_data pointer in struct device, the functions dev_get_drvdata() and dev_set_drvdata() should be used.

---

drivers/firewire/fw-sbp2.c +3 -3
index 2bcf515..a70e66e 100644
@@ -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));
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Roel Kluin

To avoid direct access to the driver_data pointer in struct device, the functions dev_get_drvdata() and dev_set_drvdata() should be used.

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

Quoted 32 lines

---

drivers/firewire/fw-sbp2.c +3 -3
index 2bcf515..a70e66e 100644
@@ -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));
Signature · 3 lines
Stefan Richter
-=====-=-=== -=-= -==-=
http://arcgraph.de/sr/
#2 lore raw
Quoted 6 lines · Stefan Richter
Quoted 4 lines · Roel Kluin

To avoid direct access to the driver_data pointer in struct device, the functions dev_get_drvdata() and dev_set_drvdata() should be used.

Quoted 7 lines

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

Thanks, I've added your acks to the patches.

greg k-h