aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire/net.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/net.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/net.c')
-rw-r--r--drivers/firewire/net.c50
1 files changed, 24 insertions, 26 deletions
diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c
index 815b0fcbe918..6b895986dc22 100644
--- a/drivers/firewire/net.c
+++ b/drivers/firewire/net.c
@@ -1440,9 +1440,9 @@ static int fwnet_add_peer(struct fwnet_device *dev,
1440 return 0; 1440 return 0;
1441} 1441}
1442 1442
1443static int fwnet_probe(struct device *_dev) 1443static int fwnet_probe(struct fw_unit *unit,
1444 const struct ieee1394_device_id *id)
1444{ 1445{
1445 struct fw_unit *unit = fw_unit(_dev);
1446 struct fw_device *device = fw_parent_device(unit); 1446 struct fw_device *device = fw_parent_device(unit);
1447 struct fw_card *card = device->card; 1447 struct fw_card *card = device->card;
1448 struct net_device *net; 1448 struct net_device *net;
@@ -1526,6 +1526,24 @@ static int fwnet_probe(struct device *_dev)
1526 return ret; 1526 return ret;
1527} 1527}
1528 1528
1529/*
1530 * FIXME abort partially sent fragmented datagrams,
1531 * discard partially received fragmented datagrams
1532 */
1533static void fwnet_update(struct fw_unit *unit)
1534{
1535 struct fw_device *device = fw_parent_device(unit);
1536 struct fwnet_peer *peer = dev_get_drvdata(&unit->device);
1537 int generation;
1538
1539 generation = device->generation;
1540
1541 spin_lock_irq(&peer->dev->lock);
1542 peer->node_id = device->node_id;
1543 peer->generation = generation;
1544 spin_unlock_irq(&peer->dev->lock);
1545}
1546
1529static void fwnet_remove_peer(struct fwnet_peer *peer, struct fwnet_device *dev) 1547static void fwnet_remove_peer(struct fwnet_peer *peer, struct fwnet_device *dev)
1530{ 1548{
1531 struct fwnet_partial_datagram *pd, *pd_next; 1549 struct fwnet_partial_datagram *pd, *pd_next;
@@ -1542,9 +1560,9 @@ static void fwnet_remove_peer(struct fwnet_peer *peer, struct fwnet_device *dev)
1542 kfree(peer); 1560 kfree(peer);
1543} 1561}
1544 1562
1545static int fwnet_remove(struct device *_dev) 1563static void fwnet_remove(struct fw_unit *unit)
1546{ 1564{
1547 struct fwnet_peer *peer = dev_get_drvdata(_dev); 1565 struct fwnet_peer *peer = dev_get_drvdata(&unit->device);
1548 struct fwnet_device *dev = peer->dev; 1566 struct fwnet_device *dev = peer->dev;
1549 struct net_device *net; 1567 struct net_device *net;
1550 int i; 1568 int i;
@@ -1569,26 +1587,6 @@ static int fwnet_remove(struct device *_dev)
1569 } 1587 }
1570 1588
1571 mutex_unlock(&fwnet_device_mutex); 1589 mutex_unlock(&fwnet_device_mutex);
1572
1573 return 0;
1574}
1575
1576/*
1577 * FIXME abort partially sent fragmented datagrams,
1578 * discard partially received fragmented datagrams
1579 */
1580static void fwnet_update(struct fw_unit *unit)
1581{
1582 struct fw_device *device = fw_parent_device(unit);
1583 struct fwnet_peer *peer = dev_get_drvdata(&unit->device);
1584 int generation;
1585
1586 generation = device->generation;
1587
1588 spin_lock_irq(&peer->dev->lock);
1589 peer->node_id = device->node_id;
1590 peer->generation = generation;
1591 spin_unlock_irq(&peer->dev->lock);
1592} 1590}
1593 1591
1594static const struct ieee1394_device_id fwnet_id_table[] = { 1592static const struct ieee1394_device_id fwnet_id_table[] = {
@@ -1614,10 +1612,10 @@ static struct fw_driver fwnet_driver = {
1614 .owner = THIS_MODULE, 1612 .owner = THIS_MODULE,
1615 .name = KBUILD_MODNAME, 1613 .name = KBUILD_MODNAME,
1616 .bus = &fw_bus_type, 1614 .bus = &fw_bus_type,
1617 .probe = fwnet_probe,
1618 .remove = fwnet_remove,
1619 }, 1615 },
1616 .probe = fwnet_probe,
1620 .update = fwnet_update, 1617 .update = fwnet_update,
1618 .remove = fwnet_remove,
1621 .id_table = fwnet_id_table, 1619 .id_table = fwnet_id_table,
1622}; 1620};
1623 1621