net: ibm: emac: modernize modules
Subsystems (2)
cover net: ibm: emac: modernize modules
Use devm and dev_* instead of printk.
Rosen Penev (4):
net: ibm: emac: tah: use devm and dev_err
net: ibm: emac: rgmii: use devm and dev_err
net: ibm: emac: zmii: use devm and dev_err
net: ibm: emac: mal: use devm and dev_err
drivers/net/ethernet/ibm/emac/mal.c | 144 +++++++++++--------------- drivers/net/ethernet/ibm/emac/rgmii.c | 76 +++++--------- drivers/net/ethernet/ibm/emac/tah.c | 60 ++++------- drivers/net/ethernet/ibm/emac/zmii.c | 53 ++++------ 4 files changed, 127 insertions(+), 206 deletions(-)
Signature · 1 line
2.46.0
PATCH 1/4 net: ibm: emac: tah: use devm and dev_err
Simplifies the driver by removing manual frees and using dev_err instead of printk. pdev->dev has the of_node name in it. eg.
TAH /plb/opb/emac-tah@ef601350 initialized
vs
emac-tah 4ef601350.emac-tah: initialized
close enough.
--- drivers/net/ethernet/ibm/emac/tah.c | 60 ++++++++++------------------- 1 file changed, 21 insertions(+), 39 deletions(-)
drivers/net/ethernet/ibm/emac/tah.c +21 -39
@@ -43,9 +43,9 @@ void tah_detach(struct platform_device *ofdev, int channel)mutex_unlock (&dev->lock); } -void tah_reset (struct platform_device *ofdev) +void tah_reset (struct platform_device *pdev) { -struct tah_instance *dev =platform_get_drvdata (ofdev); +struct tah_instance *dev =platform_get_drvdata (pdev);struct tah_regs __iomem *p = dev->base;int n;
@@ -56,7 +56,7 @@ void tah_reset(struct platform_device *ofdev) --n;if (unlikely (!n)) -printk (KERN_ERR "%pOF: reset timeout\n" , ofdev->dev.of_node); +dev_err (&pdev->dev,"reset timeout" );/* 10KB TAH TX FIFO accommodates the max MTU of 9000 */ out_be32(&p->mr,
@@ -85,61 +85,44 @@ void *tah_dump_regs(struct platform_device *ofdev, void *buf)return regs +1 ; } -static int tah_probe (struct platform_device *ofdev) +static int tah_probe (struct platform_device *pdev) { -struct device_node *np = ofdev->dev.of_node; +struct device_node *np = pdev->dev.of_node;struct tah_instance *dev;struct resource regs;int rc; - rc = -ENOMEM ; - dev =kzalloc (sizeof (struct tah_instance ),GFP_KERNEL ); -if (dev ==NULL ) - goto err_gone; + dev =devm_kzalloc (&pdev->dev,sizeof (struct tah_instance ),GFP_KERNEL ); +if (!dev) +return -ENOMEM ;mutex_init (&dev->lock); - dev->ofdev = ofdev; + dev->ofdev = pdev; - rc = -ENXIO ; -if (of_address_to_resource (np,0 , ®s)) { -printk (KERN_ERR "%pOF: Can't get registers address\n" , np); - goto err_free; + rc =of_address_to_resource (np,0 , ®s); +if (rc) { +dev_err (&pdev->dev,"can't get registers address" ); +return rc; } - rc = -ENOMEM ; - dev->base = (struct tah_regs __iomem *)ioremap (regs.start, -sizeof (struct tah_regs )); -if (dev->base ==NULL ) { -printk (KERN_ERR "%pOF: Can't map device registers!\n" , np); - goto err_free; + dev->base = +devm_ioremap (&pdev->dev, regs.start,sizeof (struct tah_regs )); +if (!dev->base) { +dev_err (&pdev->dev,"can't map device registers" ); +return -ENOMEM ; } -platform_set_drvdata (ofdev, dev); +platform_set_drvdata (pdev, dev);/* Initialize TAH and enable IPv4 checksum verification, no TSO yet */ -tah_reset (ofdev); +tah_reset (pdev); -printk (KERN_INFO "TAH %pOF initialized\n" , ofdev->dev.of_node); +dev_info (&pdev->dev,"initialized" );wmb (); -return 0 ; - - err_free: -kfree (dev); - err_gone:return rc; } -static void tah_remove (struct platform_device *ofdev) -{ -struct tah_instance *dev =platform_get_drvdata (ofdev); - -WARN_ON (dev->users !=0 ); - -iounmap (dev->base); -kfree (dev); -} -static const struct of_device_id tah_match[] = { {
@@ -158,7 +141,6 @@ static struct platform_driver tah_driver = { .of_match_table = tah_match, }, .probe = tah_probe, - .remove_new = tah_remove, };int __init tah_init (void )
Signature · 1 line
2.46.0
Re: [PATCH net-next 1/4] net: ibm: emac: tah: use devm and dev_err
Quoted 10 lines · Rosen Penev
Simplifies the driver by removing manual frees and using
dev_errinstead of printk.pdev->devhas theof_nodename in it. eg.TAH /plb/opb/emac-tah@ef601350 initialized
vs
emac-tah 4ef601350.emac-tah: initialized
close enough.
There are lots of different things going on in this patch. It would be better to split it up.
drivers/net/ethernet/ibm/emac/tah.c void tah_detach(struct platform_device *ofdev, int channel) · line 46
Quoted 2 lines
drivers/net/ethernet/ibm/emac/tah.c +1
-1-void tah_reset (struct platform_device *ofdev) +void tah_reset (struct platform_device *pdev)
Search/replace would be one patch.
drivers/net/ethernet/ibm/emac/tah.c void tah_reset(struct platform_device *ofdev) · line 59
Quoted 12 lines
{
drivers/net/ethernet/ibm/emac/tah.c +2
-2-struct tah_instance *dev =platform_get_drvdata (ofdev); +struct tah_instance *dev =platform_get_drvdata (pdev);struct tah_regs __iomem *p = dev->base;int n;@@ -56,7 +56,7 @@ void tah_reset(struct platform_device *ofdev) --n;if (unlikely (!n)) -printk (KERN_ERR "%pOF: reset timeout\n" , ofdev->dev.of_node); +dev_err (&pdev->dev,"reset timeout" );
printk() to dev_err() another patch.
drivers/net/ethernet/ibm/emac/tah.c void *tah_dump_regs(struct platform_device *ofdev, void *buf) · line 97
Quoted 8 lines
drivers/net/ethernet/ibm/emac/tah.c +3
-4- rc = -ENOMEM ; - dev =kzalloc (sizeof (struct tah_instance ),GFP_KERNEL ); -if (dev ==NULL ) - goto err_gone; + dev =devm_kzalloc (&pdev->dev,sizeof (struct tah_instance ),GFP_KERNEL ); +if (!dev) +return -ENOMEM ;
devm another patch.
drivers/net/ethernet/ibm/emac/tah.c void *tah_dump_regs(struct platform_device *ofdev, void *buf) · line 100
Quoted 3 lines
drivers/net/ethernet/ibm/emac/tah.c +1
-1mutex_init (&dev->lock); - dev->ofdev = ofdev; + dev->ofdev = pdev;
It seems odd to not also rename dev->ofdev to dev->pdev, so it is consistent.
Andrew
---
pw-bot: cr
PATCH 2/4 net: ibm: emac: rgmii: use devm and dev_err
In reply to Rosen PenevSimplifies the driver by removing manual frees and using dev_err instead of printk. pdev->dev has the of_node name in it. eg.
RGMII /plb/opb/emac-rgmii@ef601500 initialized with MDIO support
vs.
emac-rgmii 4ef601500.emac-rgmii: initialized with MDIO support
Close enough.
--- drivers/net/ethernet/ibm/emac/rgmii.c | 76 ++++++++++----------------- 1 file changed, 27 insertions(+), 49 deletions(-)
drivers/net/ethernet/ibm/emac/rgmii.c +27 -49
@@ -77,17 +77,16 @@ static inline u32 rgmii_mode_mask(int mode, int input) } } -int rgmii_attach (struct platform_device *ofdev,int input,int mode) +int rgmii_attach (struct platform_device *pdev,int input,int mode) { -struct rgmii_instance *dev =platform_get_drvdata (ofdev); +struct rgmii_instance *dev =platform_get_drvdata (pdev);struct rgmii_regs __iomem *p = dev->base;RGMII_DBG (dev,"attach(%d)" NL , input);/* Check if we need to attach to a RGMII */ if (input <0 || !rgmii_valid_mode (mode)) { -printk (KERN_ERR "%pOF: unsupported settings !\n" , - ofdev->dev.of_node); +dev_err (&pdev->dev,"unsupported settings" );return -ENODEV ; }
@@ -96,8 +95,7 @@ int rgmii_attach(struct platform_device *ofdev, int input, int mode)/* Enable this input */ out_be32 (&p->fer,in_be32 (&p->fer) |rgmii_mode_mask (mode, input)); -printk (KERN_NOTICE "%pOF: input %d in %s mode\n" , - ofdev->dev.of_node, input,phy_modes (mode)); +dev_info (&pdev->dev,"input %d in %s mode" , input,phy_modes (mode)); ++dev->users;
@@ -213,76 +211,57 @@ void *rgmii_dump_regs(struct platform_device *ofdev, void *buf)return regs +1 ; } - -static int rgmii_probe (struct platform_device *ofdev) +static int rgmii_probe (struct platform_device *pdev) { -struct device_node *np = ofdev->dev.of_node; +struct device_node *np = pdev->dev.of_node;struct rgmii_instance *dev;struct resource regs;int rc; - rc = -ENOMEM ; - dev =kzalloc (sizeof (struct rgmii_instance ),GFP_KERNEL ); -if (dev ==NULL ) - goto err_gone; + dev =devm_kzalloc (&pdev->dev,sizeof (struct rgmii_instance ), +GFP_KERNEL ); +if (!dev) +return -ENOMEM ;mutex_init (&dev->lock); - dev->ofdev = ofdev; + dev->ofdev = pdev; - rc = -ENXIO ; -if (of_address_to_resource (np,0 , ®s)) { -printk (KERN_ERR "%pOF: Can't get registers address\n" , np); - goto err_free; + rc =of_address_to_resource (np,0 , ®s); +if (rc) { +dev_err (&pdev->dev,"can't get registers address" ); +return rc; } - rc = -ENOMEM ; - dev->base = (struct rgmii_regs __iomem *)ioremap (regs.start, -sizeof (struct rgmii_regs )); -if (dev->base ==NULL ) { -printk (KERN_ERR "%pOF: Can't map device registers!\n" , np); - goto err_free; + dev->base = +devm_ioremap (&pdev->dev, regs.start,sizeof (struct rgmii_regs )); +if (!dev->base) { +dev_err (&pdev->dev,"can't map device registers" ); +return -ENOMEM ; }/* Check for RGMII flags */ -if (of_property_read_bool (ofdev->dev.of_node,"has-mdio" )) +if (of_property_read_bool (pdev->dev.of_node,"has-mdio" )) dev->flags |=EMAC_RGMII_FLAG_HAS_MDIO ;/* CAB lacks the right properties, fix this up */ -if (of_device_is_compatible (ofdev->dev.of_node,"ibm,rgmii-axon" )) +if (of_device_is_compatible (pdev->dev.of_node,"ibm,rgmii-axon" )) dev->flags |=EMAC_RGMII_FLAG_HAS_MDIO ; -DBG2 (dev," Boot FER = 0x%08x, SSR = 0x%08x\n" , -in_be32 (&dev->base->fer),in_be32 (&dev->base->ssr)); +dev_dbg (&pdev->dev,"Boot FER = 0x%08x, SSR = 0x%08x" , +in_be32 (&dev->base->fer),in_be32 (&dev->base->ssr));/* Disable all inputs by default */ out_be32 (&dev->base->fer,0 ); -printk (KERN_INFO -"RGMII %pOF initialized with%s MDIO support\n" , - ofdev->dev.of_node, - (dev->flags &EMAC_RGMII_FLAG_HAS_MDIO ) ?"" :"out" ); +dev_info (&pdev->dev,"initialized with%s MDIO support" , + (dev->flags &EMAC_RGMII_FLAG_HAS_MDIO ) ?"" :"out" );wmb (); -platform_set_drvdata (ofdev, dev); +platform_set_drvdata (pdev, dev); -return 0 ; - - err_free: -kfree (dev); - err_gone:return rc; } -static void rgmii_remove (struct platform_device *ofdev) -{ -struct rgmii_instance *dev =platform_get_drvdata (ofdev); - -WARN_ON (dev->users !=0 ); - -iounmap (dev->base); -kfree (dev); -} -static const struct of_device_id rgmii_match[] = { {
@@ -300,7 +279,6 @@ static struct platform_driver rgmii_driver = { .of_match_table = rgmii_match, }, .probe = rgmii_probe, - .remove_new = rgmii_remove, };int __init rgmii_init (void )
Signature · 1 line
2.46.0
PATCH 3/4 net: ibm: emac: zmii: use devm and dev_err
In reply to Rosen PenevSimplifies the driver by removing manual frees and using dev_err instead of printk. pdev->dev has the of_node name in it.
--- drivers/net/ethernet/ibm/emac/zmii.c | 53 ++++++++++------------------ 1 file changed, 18 insertions(+), 35 deletions(-)
drivers/net/ethernet/ibm/emac/zmii.c +18 -35
@@ -230,34 +230,33 @@ void *zmii_dump_regs(struct platform_device *ofdev, void *buf)return regs +1 ; } -static int zmii_probe (struct platform_device *ofdev) +static int zmii_probe (struct platform_device *pdev) { -struct device_node *np = ofdev->dev.of_node; +struct device_node *np = pdev->dev.of_node;struct zmii_instance *dev;struct resource regs;int rc; - rc = -ENOMEM ; - dev =kzalloc (sizeof (struct zmii_instance ),GFP_KERNEL ); -if (dev ==NULL ) - goto err_gone; + dev =devm_kzalloc (&pdev->dev,sizeof (struct zmii_instance ), +GFP_KERNEL ); +if (!dev) +return -ENOMEM ;mutex_init (&dev->lock); - dev->ofdev = ofdev; + dev->ofdev = pdev; dev->mode =PHY_INTERFACE_MODE_NA ; - rc = -ENXIO ; -if (of_address_to_resource (np,0 , ®s)) { -printk (KERN_ERR "%pOF: Can't get registers address\n" , np); - goto err_free; + rc =of_address_to_resource (np,0 , ®s); +if (rc) { +dev_err (&pdev->dev,"can't get registers address" ); +return rc; } - rc = -ENOMEM ; - dev->base = (struct zmii_regs __iomem *)ioremap (regs.start, -sizeof (struct zmii_regs )); -if (dev->base ==NULL ) { -printk (KERN_ERR "%pOF: Can't map device registers!\n" , np); - goto err_free; + dev->base = +devm_ioremap (&pdev->dev, regs.start,sizeof (struct zmii_regs )); +if (!dev->base) { +dev_err (&pdev->dev,"can't map device registers" ); +return -ENOMEM ; }/* We may need FER value for autodetection later */
@@ -266,28 +265,13 @@ static int zmii_probe(struct platform_device *ofdev)/* Disable all inputs by default */ out_be32 (&dev->base->fer,0 ); -printk (KERN_INFO "ZMII %pOF initialized\n" , ofdev->dev.of_node); +dev_info (&pdev->dev,"initialized" );wmb (); -platform_set_drvdata (ofdev, dev); +platform_set_drvdata (pdev, dev); -return 0 ; - - err_free: -kfree (dev); - err_gone:return rc; } -static void zmii_remove (struct platform_device *ofdev) -{ -struct zmii_instance *dev =platform_get_drvdata (ofdev); - -WARN_ON (dev->users !=0 ); - -iounmap (dev->base); -kfree (dev); -} -static const struct of_device_id zmii_match[] = { {
@@ -306,7 +290,6 @@ static struct platform_driver zmii_driver = { .of_match_table = zmii_match, }, .probe = zmii_probe, - .remove_new = zmii_remove, };int __init zmii_init (void )
Signature · 1 line
2.46.0
PATCH 4/4 net: ibm: emac: mal: use devm and dev_err
In reply to Rosen PenevSimplifies the driver by removing manual frees and using dev_err instead of printk. pdev->dev has the of_node name in it. eg.
MAL v2 /plb/mcmal, 1 TX channels, 1 RX channels
vs
mcmal plb:mcmal: MAL version 2, 1 TX channels, 1 RX channels
Close enough
--- drivers/net/ethernet/ibm/emac/mal.c | 144 ++++++++++++---------------- 1 file changed, 61 insertions(+), 83 deletions(-)
drivers/net/ethernet/ibm/emac/mal.c +61 -83
@@ -513,7 +513,7 @@ void *mal_dump_regs(struct mal_instance *mal, void *buf)return regs +1 ; } -static int mal_probe (struct platform_device *ofdev) +static int mal_probe (struct platform_device *pdev) {struct mal_instance *mal;int err =0 , i, bd_size;
@@ -524,79 +524,71 @@ static int mal_probe(struct platform_device *ofdev)unsigned long irqflags;irq_handler_t hdlr_serr, hdlr_txde, hdlr_rxde; - mal =kzalloc (sizeof (struct mal_instance ),GFP_KERNEL ); + mal =devm_kzalloc (&pdev->dev,sizeof (struct mal_instance ),GFP_KERNEL );if (!mal)return -ENOMEM ; mal->index = index; - mal->ofdev = ofdev; - mal->version =of_device_is_compatible (ofdev->dev.of_node,"ibm,mcmal2" ) ?2 :1 ; + mal->ofdev = pdev; +if (of_device_is_compatible (pdev->dev.of_node,"ibm,mcmal2" )) + mal->version =2 ; +else + mal->version =1 ;MAL_DBG (mal,"probe" NL ); - prop =of_get_property (ofdev->dev.of_node,"num-tx-chans" ,NULL ); -if (prop ==NULL ) { -printk (KERN_ERR -"mal%d: can't find MAL num-tx-chans property!\n" , - index); - err = -ENODEV ; - goto fail; + prop =of_get_property (pdev->dev.of_node,"num-tx-chans" ,NULL ); +if (!prop) { +dev_err (&pdev->dev, +"mal%d: can't find MAL num-tx-chans property" , index); +return -ENODEV ; } mal->num_tx_chans = prop[0 ]; - prop =of_get_property (ofdev->dev.of_node,"num-rx-chans" ,NULL ); -if (prop ==NULL ) { -printk (KERN_ERR -"mal%d: can't find MAL num-rx-chans property!\n" , - index); - err = -ENODEV ; - goto fail; + prop =of_get_property (pdev->dev.of_node,"num-rx-chans" ,NULL ); +if (!prop) { +dev_err (&pdev->dev, +"mal%d: can't find MAL num-rx-chans property" , index); +return -ENODEV ; } mal->num_rx_chans = prop[0 ]; - dcr_base =dcr_resource_start (ofdev->dev.of_node,0 ); + dcr_base =dcr_resource_start (pdev->dev.of_node,0 );if (dcr_base ==0 ) { -printk (KERN_ERR -"mal%d: can't find DCR resource!\n" , index); - err = -ENODEV ; - goto fail; +dev_err (&pdev->dev,"mal%d: can't find DCR resource" , index); +return -ENODEV ; } - mal->dcr_host =dcr_map (ofdev->dev.of_node, dcr_base,0x100 ); + mal->dcr_host =dcr_map (pdev->dev.of_node, dcr_base,0x100 );if (!DCR_MAP_OK (mal->dcr_host)) { -printk (KERN_ERR -"mal%d: failed to map DCRs !\n" , index); - err = -ENODEV ; - goto fail; +dev_err (&pdev->dev,"mal%d: failed to map DCRs" , index); +return -ENODEV ; } -if (of_device_is_compatible (ofdev->dev.of_node,"ibm,mcmal-405ez" )) { +if (of_device_is_compatible (pdev->dev.of_node,"ibm,mcmal-405ez" )) {#if defined(CONFIG_IBM_EMAC_MAL_CLR_ICINTSTAT ) && \ defined(CONFIG_IBM_EMAC_MAL_COMMON_ERR ) mal->features |= (MAL_FTR_CLEAR_ICINTSTAT |MAL_FTR_COMMON_ERR_INT );#else -printk (KERN_ERR "%pOF: Support for 405EZ not enabled!\n" , - ofdev->dev.of_node); - err = -ENODEV ; - goto fail; +dev_err (&pdev->dev,"support for 405EZ not enabled" ); +return -ENODEV ;#endif } - mal->txeob_irq =irq_of_parse_and_map (ofdev->dev.of_node,0 ); - mal->rxeob_irq =irq_of_parse_and_map (ofdev->dev.of_node,1 ); - mal->serr_irq =irq_of_parse_and_map (ofdev->dev.of_node,2 ); + mal->txeob_irq =irq_of_parse_and_map (pdev->dev.of_node,0 ); + mal->rxeob_irq =irq_of_parse_and_map (pdev->dev.of_node,1 ); + mal->serr_irq =irq_of_parse_and_map (pdev->dev.of_node,2 );if (mal_has_feature (mal,MAL_FTR_COMMON_ERR_INT )) { mal->txde_irq = mal->rxde_irq = mal->serr_irq; }else { - mal->txde_irq =irq_of_parse_and_map (ofdev->dev.of_node,3 ); - mal->rxde_irq =irq_of_parse_and_map (ofdev->dev.of_node,4 ); + mal->txde_irq =irq_of_parse_and_map (pdev->dev.of_node,3 ); + mal->rxde_irq =irq_of_parse_and_map (pdev->dev.of_node,4 ); }if (!mal->txeob_irq || !mal->rxeob_irq || !mal->serr_irq || !mal->txde_irq || !mal->rxde_irq) { -printk (KERN_ERR -"mal%d: failed to map interrupts !\n" , index); +dev_err (&pdev->dev,"mal%d: failed to map interrupts" , index); err = -ENODEV ; goto fail_unmap; }
@@ -624,7 +616,7 @@ static int mal_probe(struct platform_device *ofdev)/* Current Axon is not happy with priority being non-0, it can * deadlock, fix it up here */ -if (of_device_is_compatible (ofdev->dev.of_node,"ibm,mcmal-axon" )) +if (of_device_is_compatible (pdev->dev.of_node,"ibm,mcmal-axon" )) cfg &= ~(MAL2_CFG_RPP_10 |MAL2_CFG_WPP_10 );/* Apply configuration */
@@ -637,7 +629,7 @@ static int mal_probe(struct platform_device *ofdev) bd_size =sizeof (struct mal_descriptor ) * (NUM_TX_BUFF * mal->num_tx_chans +NUM_RX_BUFF * mal->num_rx_chans); - mal->bd_virt =dma_alloc_coherent (&ofdev->dev, bd_size, &mal->bd_dma, + mal->bd_virt =dma_alloc_coherent (&pdev->dev, bd_size, &mal->bd_dma,GFP_KERNEL );if (mal->bd_virt ==NULL ) { err = -ENOMEM ;
@@ -664,21 +656,26 @@ static int mal_probe(struct platform_device *ofdev) hdlr_rxde = mal_rxde; } - err =request_irq (mal->serr_irq, hdlr_serr, irqflags,"MAL SERR" , mal); + err =devm_request_irq (&pdev->dev, mal->serr_irq, hdlr_serr, irqflags, +"MAL SERR" , mal);if (err) goto fail2; - err =request_irq (mal->txde_irq, hdlr_txde, irqflags,"MAL TX DE" , mal); + err =devm_request_irq (&pdev->dev, mal->txde_irq, hdlr_txde, irqflags, +"MAL TX DE" , mal);if (err) - goto fail3; - err =request_irq (mal->txeob_irq, mal_txeob,0 ,"MAL TX EOB" , mal); + goto fail2; + err =devm_request_irq (&pdev->dev, mal->txeob_irq, mal_txeob,0 , +"MAL TX EOB" , mal);if (err) - goto fail4; - err =request_irq (mal->rxde_irq, hdlr_rxde, irqflags,"MAL RX DE" , mal); + goto fail2; + err =devm_request_irq (&pdev->dev, mal->rxde_irq, hdlr_rxde, irqflags, +"MAL RX DE" , mal);if (err) - goto fail5; - err =request_irq (mal->rxeob_irq, mal_rxeob,0 ,"MAL RX EOB" , mal); + goto fail2; + err =devm_request_irq (&pdev->dev, mal->rxeob_irq, mal_rxeob,0 , +"MAL RX EOB" , mal);if (err) - goto fail6; + goto fail2;/* Enable all MAL SERR interrupt sources */ set_mal_dcrn (mal,MAL_IER ,MAL_IER_EVENTS );
@@ -686,40 +683,28 @@ static int mal_probe(struct platform_device *ofdev)/* Enable EOB interrupt */ mal_enable_eob_irq (mal); -printk (KERN_INFO -"MAL v%d %pOF, %d TX channels, %d RX channels\n" , - mal->version, ofdev->dev.of_node, - mal->num_tx_chans, mal->num_rx_chans); +dev_err (&pdev->dev,"MAL version %d, %d TX channels, %d RX channels" , + mal->version, mal->num_tx_chans, mal->num_rx_chans);/* Advertise this instance to the rest of the world */ wmb (); -platform_set_drvdata (ofdev, mal); +platform_set_drvdata (pdev, mal);return 0 ; - fail6: -free_irq (mal->rxde_irq, mal); - fail5: -free_irq (mal->txeob_irq, mal); - fail4: -free_irq (mal->txde_irq, mal); - fail3: -free_irq (mal->serr_irq, mal); - fail2: -dma_free_coherent (&ofdev->dev, bd_size, mal->bd_virt, mal->bd_dma); - fail_dummy: +fail2: +dma_free_coherent (&pdev->dev, bd_size, mal->bd_virt, mal->bd_dma); +fail_dummy:free_netdev (mal->dummy_dev); - fail_unmap: +fail_unmap:dcr_unmap (mal->dcr_host,0x100 ); - fail: -kfree (mal);return err; } -static void mal_remove (struct platform_device *ofdev) +static void mal_remove (struct platform_device *pdev) { -struct mal_instance *mal =platform_get_drvdata (ofdev); +struct mal_instance *mal =platform_get_drvdata (pdev);MAL_DBG (mal,"remove" NL );
@@ -732,22 +717,15 @@ static void mal_remove(struct platform_device *ofdev)"mal%d: commac list is not empty on remove!\n" , mal->index); -free_irq (mal->serr_irq, mal); -free_irq (mal->txde_irq, mal); -free_irq (mal->txeob_irq, mal); -free_irq (mal->rxde_irq, mal); -free_irq (mal->rxeob_irq, mal); -mal_reset (mal);free_netdev (mal->dummy_dev); -dma_free_coherent (&ofdev->dev, +dma_free_coherent (&pdev->dev,sizeof (struct mal_descriptor ) * - (NUM_TX_BUFF * mal->num_tx_chans + -NUM_RX_BUFF * mal->num_rx_chans), mal->bd_virt, - mal->bd_dma); -kfree (mal); + (NUM_TX_BUFF * mal->num_tx_chans + +NUM_RX_BUFF * mal->num_rx_chans), + mal->bd_virt, mal->bd_dma); } static const struct of_device_id mal_platform_match[] =
Signature · 1 line
2.46.0