aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/firewire/firedtv-fw.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/media/firewire/firedtv-fw.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/media/firewire/firedtv-fw.c')
-rw-r--r--drivers/media/firewire/firedtv-fw.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/media/firewire/firedtv-fw.c b/drivers/media/firewire/firedtv-fw.c
index e24ec539a5fd..247f0e7cb5f7 100644
--- a/drivers/media/firewire/firedtv-fw.c
+++ b/drivers/media/firewire/firedtv-fw.c
@@ -248,7 +248,7 @@ static const char * const model_names[] = {
248/* Adjust the template string if models with longer names appear. */ 248/* Adjust the template string if models with longer names appear. */
249#define MAX_MODEL_NAME_LEN sizeof("FireDTV ????") 249#define MAX_MODEL_NAME_LEN sizeof("FireDTV ????")
250 250
251static int node_probe(struct device *dev) 251static int node_probe(struct fw_unit *unit, const struct ieee1394_device_id *id)
252{ 252{
253 struct firedtv *fdtv; 253 struct firedtv *fdtv;
254 char name[MAX_MODEL_NAME_LEN]; 254 char name[MAX_MODEL_NAME_LEN];
@@ -258,8 +258,8 @@ static int node_probe(struct device *dev)
258 if (!fdtv) 258 if (!fdtv)
259 return -ENOMEM; 259 return -ENOMEM;
260 260
261 dev_set_drvdata(dev, fdtv); 261 dev_set_drvdata(&unit->device, fdtv);
262 fdtv->device = dev; 262 fdtv->device = &unit->device;
263 fdtv->isochannel = -1; 263 fdtv->isochannel = -1;
264 fdtv->voltage = 0xff; 264 fdtv->voltage = 0xff;
265 fdtv->tone = 0xff; 265 fdtv->tone = 0xff;
@@ -269,7 +269,7 @@ static int node_probe(struct device *dev)
269 mutex_init(&fdtv->demux_mutex); 269 mutex_init(&fdtv->demux_mutex);
270 INIT_WORK(&fdtv->remote_ctrl_work, avc_remote_ctrl_work); 270 INIT_WORK(&fdtv->remote_ctrl_work, avc_remote_ctrl_work);
271 271
272 name_len = fw_csr_string(fw_unit(dev)->directory, CSR_MODEL, 272 name_len = fw_csr_string(unit->directory, CSR_MODEL,
273 name, sizeof(name)); 273 name, sizeof(name));
274 for (i = ARRAY_SIZE(model_names); --i; ) 274 for (i = ARRAY_SIZE(model_names); --i; )
275 if (strlen(model_names[i]) <= name_len && 275 if (strlen(model_names[i]) <= name_len &&
@@ -277,7 +277,7 @@ static int node_probe(struct device *dev)
277 break; 277 break;
278 fdtv->type = i; 278 fdtv->type = i;
279 279
280 err = fdtv_register_rc(fdtv, dev); 280 err = fdtv_register_rc(fdtv, &unit->device);
281 if (err) 281 if (err)
282 goto fail_free; 282 goto fail_free;
283 283
@@ -307,9 +307,9 @@ fail_free:
307 return err; 307 return err;
308} 308}
309 309
310static int node_remove(struct device *dev) 310static void node_remove(struct fw_unit *unit)
311{ 311{
312 struct firedtv *fdtv = dev_get_drvdata(dev); 312 struct firedtv *fdtv = dev_get_drvdata(&unit->device);
313 313
314 fdtv_dvb_unregister(fdtv); 314 fdtv_dvb_unregister(fdtv);
315 315
@@ -320,7 +320,6 @@ static int node_remove(struct device *dev)
320 fdtv_unregister_rc(fdtv); 320 fdtv_unregister_rc(fdtv);
321 321
322 kfree(fdtv); 322 kfree(fdtv);
323 return 0;
324} 323}
325 324
326static void node_update(struct fw_unit *unit) 325static void node_update(struct fw_unit *unit)
@@ -391,10 +390,10 @@ static struct fw_driver fdtv_driver = {
391 .owner = THIS_MODULE, 390 .owner = THIS_MODULE,
392 .name = "firedtv", 391 .name = "firedtv",
393 .bus = &fw_bus_type, 392 .bus = &fw_bus_type,
394 .probe = node_probe,
395 .remove = node_remove,
396 }, 393 },
394 .probe = node_probe,
397 .update = node_update, 395 .update = node_update,
396 .remove = node_remove,
398 .id_table = fdtv_id_table, 397 .id_table = fdtv_id_table,
399}; 398};
400 399