All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Vaibhav Gupta <vaibhav.varodek@gmail.com>
Cc: linux-kernel-mentees@lists.linuxfoundation.org,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Vaibhav Gupta <vaibhavgupta40@gmail.com>
Subject: Re: [Linux-kernel-mentees] [PATCH v1 2/2] realtek/8139cp: Remove Legacy Power Management
Date: Fri, 24 Apr 2020 10:01:23 -0500	[thread overview]
Message-ID: <20200424150123.GA133694@google.com> (raw)
In-Reply-To: <CAPBsFfDvP2zGUbGj8nNZcBfTRhTeAsxMZtS1Kea_p9V9dWBYbA@mail.gmail.com>

On Fri, Apr 24, 2020 at 07:34:50PM +0530, Vaibhav Gupta wrote:
> > >
> > > But in case of "__maybe_unused", we don't keep a check while binding
> > > ".driver.pm".
> > > Hence, if CONFIG_PM_SLEEP is not defined, still the ".driver.pm" is
> > > bind with a structure
> > > with some random initial values.
> > >
> > > We can use the mix of both?
> > > __maybe_unused xyz_suspend(){}
> > > __maybe_unused xyz_resume(){}
> > > ...
> > > #ifdef CONFIG_PM_SLEEP
> > > .driver.pm = &xyz_pm_ops;
> > > #endif
> >
> > I don't think we need the mix because when CONFIG_PM_SLEEP isn't
> > defined, SIMPLE_DEV_PM_OPS() compiles to:
> >
> >   const struct dev_pm_ops xyz_pm_ops = { }
> >
> > and the xyz_pm_ops struct should be zero-filled.  The #ifdef around
> > ".driver.pm = &xyz_pm_ops" doesn't buy us anything -- the space for
> > the driver.pm pointer is there regardless, so we don't save any space,
> > and the default initialization is zero-filled, so the result is the
> > same.
> 
> Then, I guess my step to remove "#ifdef CONFIG_PM" won't go complete
> waste, I should just use "__maybe_unused" with suspend() and resume()
> to suppress warnings. Right?

Yes, that's what I'd do.  This is all window dressing; the important
thing is getting the semantic change right, i.e., the transformations
of the xyz_suspend() and xyz_resume() functions.  This #ifdef and
__maybe_unused stuff can be trivially changed if necessary.

Bjorn
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

  reply	other threads:[~2020-04-24 15:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-23 13:27 [Linux-kernel-mentees] [PATCH v1 1/2] realtek/8139too: Remove Legacy Power Management Vaibhav Gupta
2020-04-23 13:28 ` [Linux-kernel-mentees] [PATCH v1 2/2] realtek/8139cp: " Vaibhav Gupta
2020-04-24  3:47   ` Bjorn Helgaas
2020-04-24 10:31     ` Vaibhav Gupta
2020-04-24 12:44       ` Bjorn Helgaas
2020-04-24 13:00         ` Vaibhav Gupta
2020-04-24 13:59           ` Bjorn Helgaas
2020-04-24 14:04             ` Vaibhav Gupta
2020-04-24 15:01               ` Bjorn Helgaas [this message]
2020-04-24 15:13                 ` Vaibhav Gupta
2020-04-24  3:43 ` [Linux-kernel-mentees] [PATCH v1 1/2] realtek/8139too: " Bjorn Helgaas
2020-04-24 10:00   ` Vaibhav Gupta

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=20200424150123.GA133694@google.com \
    --to=helgaas@kernel.org \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=rjw@rjwysocki.net \
    --cc=vaibhav.varodek@gmail.com \
    --cc=vaibhavgupta40@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.