netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Jeff Garzik <jgarzik@pobox.com>, netdev@vger.kernel.org
Subject: Re: [PATCH] CONFIG_PM=n slim: drivers/net/*
Date: Fri, 11 Aug 2006 19:49:52 -0700	[thread overview]
Message-ID: <20060811194952.9d664698.akpm@osdl.org> (raw)
In-Reply-To: <20060812023014.GP6847@martell.zuzino.mipt.ru>

On Sat, 12 Aug 2006 06:30:14 +0400
Alexey Dobriyan <adobriyan@gmail.com> wrote:

> On Fri, Aug 11, 2006 at 06:49:43PM -0700, Andrew Morton wrote:
> > On Sat, 12 Aug 2006 04:46:23 +0400
> > Alexey Dobriyan <adobriyan@gmail.com> wrote:
> >
> > > +#ifdef CONFIG_PM
> > >  static int amd8111e_suspend(struct pci_dev *pci_dev, pm_message_t state)
> > >  {
> > >  	struct net_device *dev = pci_get_drvdata(pci_dev);
> > > @@ -1873,7 +1879,7 @@ static int amd8111e_resume(struct pci_de
> > >
> > >  	return 0;
> > >  }
> > > -
> > > +#endif
> > >
> > >  static void __devexit amd8111e_remove_one(struct pci_dev *pdev)
> > >  {
> > > @@ -2152,8 +2158,10 @@ static struct pci_driver amd8111e_driver
> > >  	.id_table	= amd8111e_pci_tbl,
> > >  	.probe		= amd8111e_probe_one,
> > >  	.remove		= __devexit_p(amd8111e_remove_one),
> > > +#ifdef CONFIG_PM
> > >  	.suspend	= amd8111e_suspend,
> > >  	.resume		= amd8111e_resume
> > > +#endif
> > >  };
> >
> > The preferred way is
> >
> > #ifdef CONFIG_PM
> > static int amd8111e_suspend(...)
> > {
> > }
> > #else
> > #define amd8111e_suspend NULL
> > #define amd8111e_resume NULL
> > #endif
> 
> Plenty of drivers already use first variant.

That can be fixed.

> Also this won't allow
> 
> 	struct pci_driver {
> 		...
> 	#ifdef CONFIG_PM
> 		int (*suspend)(...);
> 		int (*resume)(...);
> 	#endif
> 		...
> 	};
> 
> which is good for a) space savings in CONFIG_PM=n case, and
> b) making drivers care about CONFIG_PM=n users hard way aka compilation
> failure.

eh?  Both versions will generate identical code.

  reply	other threads:[~2006-08-12  2:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-12  0:46 [PATCH] CONFIG_PM=n slim: drivers/net/* Alexey Dobriyan
2006-08-12  1:49 ` Andrew Morton
2006-08-12  2:30   ` Alexey Dobriyan
2006-08-12  2:49     ` Andrew Morton [this message]
2006-08-12 17:06       ` Roland Dreier
2006-08-12 18:39         ` Andrew Morton

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=20060811194952.9d664698.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=adobriyan@gmail.com \
    --cc=jgarzik@pobox.com \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).