public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@mandrakesoft.com>
To: "Adam J. Richter" <adam@yggdrasil.com>
Cc: willy@meta-x.org, davem@redhat.com, linux-kernel@vger.kernel.org,
	wtarreau@yahoo.fr
Subject: Re: sunhme.c patch for new PCI interface (UNTESTED)
Date: Fri, 17 Nov 2000 16:42:16 -0500	[thread overview]
Message-ID: <3A15A638.86278EBB@mandrakesoft.com> (raw)
In-Reply-To: <200011160833.AAA06880@adam.yggdrasil.com>

"Adam J. Richter" wrote:
> -static struct happy_meal *root_happy_dev = NULL;
> -
>  #ifdef CONFIG_SBUS
> +static struct happy_meal *root_happy_dev = NULL;
>  static struct quattro *qfe_sbus_list = NULL;
>  #endif

don't initialize static to zero/null explicitly..
> -       if (dev == NULL) {
> -               dev = init_etherdev(0, sizeof(struct happy_meal));
> -       } else {
> -               dev->priv = kmalloc(sizeof(struct happy_meal), GFP_KERNEL);
> -               if (dev->priv == NULL)
> -                       return -ENOMEM;
> -       }
> +       dev = init_etherdev(0, sizeof(struct happy_meal));

allocation failure not checked

> -static int __init happy_meal_pci_init(struct net_device *dev, struct pci_dev *pdev)
> +static int __devinit happy_meal_pci_probe(struct pci_dev *pdev,
> +                                         const struct pci_device_id *id)

Are you aware of any hotplug sunhme hardware?  If no, don't change it to
__devinit...

> -       if (dev == NULL) {
> -               dev = init_etherdev(0, sizeof(struct happy_meal));
> -       } else {
> -               dev->priv = kmalloc(sizeof(struct happy_meal), GFP_KERNEL);
> -               if (dev->priv == NULL)
> -                       return -ENOMEM;
> -       }
> +       dev = init_etherdev(0, sizeof(struct happy_meal));

check for failure.

also, ether_setup() call is not needed if you always call
init_etherdev(NULL, ...).


> +static void __devexit happy_meal_pci_remove (struct pci_dev *pdev)
> +{
> +       struct happy_meal *hp = pdev->driver_data;
> +
> +       pci_free_consistent(hp->happy_dev,
> +                           PAGE_SIZE,
> +                           hp->happy_block,
> +                           hp->hblock_dvma);
> +       unregister_netdev(hp->dev);
> +       kfree(hp->dev);
> +}

zero pdev->driver_data.  If this driver has to be portable, use
pci_{get,set}_drvdata() instead of directly accessing ::driver_data.

> +static struct pci_device_id happymeal_pci_ids[] __devinitdata = {

again, no __devxxx if not hotplug.

>  #ifdef CONFIG_PCI
> -       cards += happy_meal_pci_probe(dev);
> +       return pci_module_init(&happy_meal_pci_driver);
> +#else
> +       return (cards > 0) ? 0 : -ENODEV;
>  #endif

ifdef not needed

> +#ifdef CONFIG_PCI
> +       pci_unregister_driver (&happy_meal_pci_driver);
> +#endif

ifdef not needed.

-- 
Jeff Garzik             |
Building 1024           | The chief enemy of creativity is "good" sense
MandrakeSoft            |          -- Picasso
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

  parent reply	other threads:[~2000-11-17 22:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-16  8:33 sunhme.c patch for new PCI interface (UNTESTED) Adam J. Richter
2000-11-16  8:45 ` David S. Miller
2000-11-16 12:13   ` Christoph Hellwig
2000-11-16 12:22     ` David S. Miller
2000-11-17  6:51       ` Zach Brown
2000-11-17 21:42 ` Jeff Garzik [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-11-16 11:10 Adam J. Richter
2000-11-16 11:07 ` David S. Miller
2000-11-17 22:15 Adam J. Richter
2000-11-17 22:40 ` Jeff Garzik
2000-11-19  6:50 ` Albert D. Cahalan
2000-11-18  1:44 Adam J. Richter
2000-11-18  2:14 Adam J. Richter
2000-11-19  7:54 Adam J. Richter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3A15A638.86278EBB@mandrakesoft.com \
    --to=jgarzik@mandrakesoft.com \
    --cc=adam@yggdrasil.com \
    --cc=davem@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=willy@meta-x.org \
    --cc=wtarreau@yahoo.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox