lkml.org 
[lkml]   [2008]   [Sep]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    SubjectRe: [PATCH 1/2] [PATCH] ne.c fix rmmod, platform driver improvements
    From
    On Mon, 8 Sep 2008 21:58:21 -0500, David Fries <david@fries.net> wrote:
    > static int __init ne_drv_probe(struct platform_device *pdev)
    > {
    > struct net_device *dev;
    > - struct resource *res;
    > - int err, irq;
    > -
    > - res = platform_get_resource(pdev, IORESOURCE_IO, 0);
    > - irq = platform_get_irq(pdev, 0);
    > - if (!res || irq < 0)
    > - return -ENODEV;
    > + int err, this_dev = pdev->id;
    >
    > dev = alloc_eip_netdev();
    > if (!dev)
    > return -ENOMEM;
    > - dev->irq = irq;
    > - dev->base_addr = res->start;
    > + dev->base_addr = io[this_dev];
    > + dev->irq = irq[this_dev];
    > + dev->mem_end = bad[this_dev];
    > err = do_ne_probe(dev);

    This breaks current users of ne platform driver. Here is a quick fix
    upon your patch.

    diff --git a/drivers/net/ne.c b/drivers/net/ne.c
    index 221e188..8b08433 100644
    --- a/drivers/net/ne.c
    +++ b/drivers/net/ne.c
    @@ -813,10 +813,26 @@ static int __init ne_drv_probe(struct platform_device *pdev)
    {
    struct net_device *dev;
    int err, this_dev = pdev->id;
    + struct resource *res;

    dev = alloc_eip_netdev();
    if (!dev)
    return -ENOMEM;
    +
    + res = platform_get_resource(pdev, IORESOURCE_IO, 0);
    + if (res) {
    + dev->base_addr = res->start;
    + dev->irq = platform_get_irq(pdev, 0);
    + err = do_ne_probe(dev);
    + if (err) {
    + free_netdev(dev);
    + return err;
    + }
    + platform_set_drvdata(pdev, dev);
    + return 0;
    + }
    + if (this_dev < 0 || this_dev >= MAX_NE_CARDS)
    + return -EINVAL;
    dev->base_addr = io[this_dev];
    dev->irq = irq[this_dev];
    dev->mem_end = bad[this_dev];

    \
     
     \ /
      Last update: 2008-09-11 15:57    [W:0.021 / U:34.060 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site