diff options
Diffstat (limited to 'drivers/ieee1394/eth1394.c')
-rw-r--r-- | drivers/ieee1394/eth1394.c | 48 |
1 files changed, 16 insertions, 32 deletions
diff --git a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c index e1fdfb5c175d..66c4cca134db 100644 --- a/drivers/ieee1394/eth1394.c +++ b/drivers/ieee1394/eth1394.c | |||
@@ -340,20 +340,13 @@ static struct eth1394_node_ref *eth1394_find_node_nodeid(struct list_head *inl, | |||
340 | return NULL; | 340 | return NULL; |
341 | } | 341 | } |
342 | 342 | ||
343 | static int eth1394_probe(struct device *dev) | 343 | static int eth1394_new_node(struct eth1394_host_info *hi, |
344 | struct unit_directory *ud) | ||
344 | { | 345 | { |
345 | struct unit_directory *ud; | ||
346 | struct eth1394_host_info *hi; | ||
347 | struct eth1394_priv *priv; | 346 | struct eth1394_priv *priv; |
348 | struct eth1394_node_ref *new_node; | 347 | struct eth1394_node_ref *new_node; |
349 | struct eth1394_node_info *node_info; | 348 | struct eth1394_node_info *node_info; |
350 | 349 | ||
351 | ud = container_of(dev, struct unit_directory, device); | ||
352 | |||
353 | hi = hpsb_get_hostinfo(ð1394_highlevel, ud->ne->host); | ||
354 | if (!hi) | ||
355 | return -ENOENT; | ||
356 | |||
357 | new_node = kmalloc(sizeof(*new_node), GFP_KERNEL); | 350 | new_node = kmalloc(sizeof(*new_node), GFP_KERNEL); |
358 | if (!new_node) | 351 | if (!new_node) |
359 | return -ENOMEM; | 352 | return -ENOMEM; |
@@ -374,10 +367,22 @@ static int eth1394_probe(struct device *dev) | |||
374 | 367 | ||
375 | priv = netdev_priv(hi->dev); | 368 | priv = netdev_priv(hi->dev); |
376 | list_add_tail(&new_node->list, &priv->ip_node_list); | 369 | list_add_tail(&new_node->list, &priv->ip_node_list); |
377 | |||
378 | return 0; | 370 | return 0; |
379 | } | 371 | } |
380 | 372 | ||
373 | static int eth1394_probe(struct device *dev) | ||
374 | { | ||
375 | struct unit_directory *ud; | ||
376 | struct eth1394_host_info *hi; | ||
377 | |||
378 | ud = container_of(dev, struct unit_directory, device); | ||
379 | hi = hpsb_get_hostinfo(ð1394_highlevel, ud->ne->host); | ||
380 | if (!hi) | ||
381 | return -ENOENT; | ||
382 | |||
383 | return eth1394_new_node(hi, ud); | ||
384 | } | ||
385 | |||
381 | static int eth1394_remove(struct device *dev) | 386 | static int eth1394_remove(struct device *dev) |
382 | { | 387 | { |
383 | struct unit_directory *ud; | 388 | struct unit_directory *ud; |
@@ -421,38 +426,17 @@ static int eth1394_update(struct unit_directory *ud) | |||
421 | struct eth1394_host_info *hi; | 426 | struct eth1394_host_info *hi; |
422 | struct eth1394_priv *priv; | 427 | struct eth1394_priv *priv; |
423 | struct eth1394_node_ref *node; | 428 | struct eth1394_node_ref *node; |
424 | struct eth1394_node_info *node_info; | ||
425 | 429 | ||
426 | hi = hpsb_get_hostinfo(ð1394_highlevel, ud->ne->host); | 430 | hi = hpsb_get_hostinfo(ð1394_highlevel, ud->ne->host); |
427 | if (!hi) | 431 | if (!hi) |
428 | return -ENOENT; | 432 | return -ENOENT; |
429 | 433 | ||
430 | priv = netdev_priv(hi->dev); | 434 | priv = netdev_priv(hi->dev); |
431 | |||
432 | node = eth1394_find_node(&priv->ip_node_list, ud); | 435 | node = eth1394_find_node(&priv->ip_node_list, ud); |
433 | if (node) | 436 | if (node) |
434 | return 0; | 437 | return 0; |
435 | 438 | ||
436 | node = kmalloc(sizeof(*node), GFP_KERNEL); | 439 | return eth1394_new_node(hi, ud); |
437 | if (!node) | ||
438 | return -ENOMEM; | ||
439 | |||
440 | node_info = kmalloc(sizeof(*node_info), GFP_KERNEL); | ||
441 | if (!node_info) { | ||
442 | kfree(node); | ||
443 | return -ENOMEM; | ||
444 | } | ||
445 | |||
446 | spin_lock_init(&node_info->pdg.lock); | ||
447 | INIT_LIST_HEAD(&node_info->pdg.list); | ||
448 | node_info->pdg.sz = 0; | ||
449 | |||
450 | ud->device.driver_data = node_info; | ||
451 | node->ud = ud; | ||
452 | |||
453 | priv = netdev_priv(hi->dev); | ||
454 | list_add_tail(&node->list, &priv->ip_node_list); | ||
455 | return 0; | ||
456 | } | 440 | } |
457 | 441 | ||
458 | static struct ieee1394_device_id eth1394_id_table[] = { | 442 | static struct ieee1394_device_id eth1394_id_table[] = { |