aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire/sbp2.c
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2013-06-09 12:15:00 -0400
committerStefan Richter <stefanr@s5r6.in-berlin.de>2013-06-09 12:15:00 -0400
commit94a87157cde95d38b9cdf1116e4f0fd93f6d25df (patch)
tree42cb11cbab50860a66d3e4191c43a85cf42bd77f /drivers/firewire/sbp2.c
parent317ddd256b9c24b0d78fa8018f80f1e495481a10 (diff)
firewire: introduce fw_driver.probe and .remove methods
FireWire upper layer drivers are converted from generic struct driver.probe() and .remove() to bus-specific struct fw_driver.probe() and .remove(). The new .probe() adds a const struct ieee1394_device_id *id argument, indicating the entry in the driver's device identifiers table which matched the fw_unit to be probed. This new argument is used by the snd-firewire-speakers driver to look up device-specific parameters and methods. There is at least one other FireWire audio driver currently in development in which this will be useful too. The new .remove() drops the unused error return code. Although all in-tree drivers are being converted to the new methods, support for the old methods is left in place in this commit. This allows public developer trees to merge this commit and then move to the new fw_driver methods. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Acked-by: Clemens Ladisch <clemens@ladisch.de> (for sound/firewire/) Cc: Peter Hurley <peter@hurleysoftware.com> (for drivers/staging/fwserial/)
Diffstat (limited to 'drivers/firewire/sbp2.c')
-rw-r--r--drivers/firewire/sbp2.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c
index 47674b913843..281029daf98c 100644
--- a/drivers/firewire/sbp2.c
+++ b/drivers/firewire/sbp2.c
@@ -1128,11 +1128,10 @@ static void sbp2_init_workarounds(struct sbp2_target *tgt, u32 model,
1128} 1128}
1129 1129
1130static struct scsi_host_template scsi_driver_template; 1130static struct scsi_host_template scsi_driver_template;
1131static int sbp2_remove(struct device *dev); 1131static void sbp2_remove(struct fw_unit *unit);
1132 1132
1133static int sbp2_probe(struct device *dev) 1133static int sbp2_probe(struct fw_unit *unit, const struct ieee1394_device_id *id)
1134{ 1134{
1135 struct fw_unit *unit = fw_unit(dev);
1136 struct fw_device *device = fw_parent_device(unit); 1135 struct fw_device *device = fw_parent_device(unit);
1137 struct sbp2_target *tgt; 1136 struct sbp2_target *tgt;
1138 struct sbp2_logical_unit *lu; 1137 struct sbp2_logical_unit *lu;
@@ -1196,7 +1195,7 @@ static int sbp2_probe(struct device *dev)
1196 return 0; 1195 return 0;
1197 1196
1198 fail_remove: 1197 fail_remove:
1199 sbp2_remove(dev); 1198 sbp2_remove(unit);
1200 return -ENOMEM; 1199 return -ENOMEM;
1201 1200
1202 fail_shost_put: 1201 fail_shost_put:
@@ -1222,9 +1221,8 @@ static void sbp2_update(struct fw_unit *unit)
1222 } 1221 }
1223} 1222}
1224 1223
1225static int sbp2_remove(struct device *dev) 1224static void sbp2_remove(struct fw_unit *unit)
1226{ 1225{
1227 struct fw_unit *unit = fw_unit(dev);
1228 struct fw_device *device = fw_parent_device(unit); 1226 struct fw_device *device = fw_parent_device(unit);
1229 struct sbp2_target *tgt = dev_get_drvdata(&unit->device); 1227 struct sbp2_target *tgt = dev_get_drvdata(&unit->device);
1230 struct sbp2_logical_unit *lu, *next; 1228 struct sbp2_logical_unit *lu, *next;
@@ -1261,10 +1259,9 @@ static int sbp2_remove(struct device *dev)
1261 kfree(lu); 1259 kfree(lu);
1262 } 1260 }
1263 scsi_remove_host(shost); 1261 scsi_remove_host(shost);
1264 dev_notice(dev, "released target %d:0:0\n", shost->host_no); 1262 dev_notice(&unit->device, "released target %d:0:0\n", shost->host_no);
1265 1263
1266 scsi_host_put(shost); 1264 scsi_host_put(shost);
1267 return 0;
1268} 1265}
1269 1266
1270#define SBP2_UNIT_SPEC_ID_ENTRY 0x0000609e 1267#define SBP2_UNIT_SPEC_ID_ENTRY 0x0000609e
@@ -1285,10 +1282,10 @@ static struct fw_driver sbp2_driver = {
1285 .owner = THIS_MODULE, 1282 .owner = THIS_MODULE,
1286 .name = KBUILD_MODNAME, 1283 .name = KBUILD_MODNAME,
1287 .bus = &fw_bus_type, 1284 .bus = &fw_bus_type,
1288 .probe = sbp2_probe,
1289 .remove = sbp2_remove,
1290 }, 1285 },
1286 .probe = sbp2_probe,
1291 .update = sbp2_update, 1287 .update = sbp2_update,
1288 .remove = sbp2_remove,
1292 .id_table = sbp2_id_table, 1289 .id_table = sbp2_id_table,
1293}; 1290};
1294 1291