All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jean Delvare <jdelvare@suse.de>
To: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Cc: "Wolfram Sang" <wsa@kernel.org>,
	"Linux I2C" <linux-i2c@vger.kernel.org>,
	"Volker Rümelin" <vr_qemu@t-online.de>,
	"Bjorn Helgaas" <helgaas@kernel.org>
Subject: Re: [PATCH] i2c: i801: Fix resume bug
Date: Tue, 1 Sep 2020 11:35:05 +0200	[thread overview]
Message-ID: <20200901113505.68faaa49@endymion> (raw)
In-Reply-To: <20200831145929.GA11480@gmail.com>

On Mon, 31 Aug 2020 20:29:29 +0530, Vaibhav Gupta wrote:
> On Fri, Aug 28, 2020 at 10:57:53AM +0200, Wolfram Sang wrote:
> > On Tue, Aug 25, 2020 at 07:13:03PM +0200, Jean Delvare wrote:  
> > > @@ -1961,8 +1965,11 @@ static int i801_suspend(struct device *d
> > >  
> > >  static int i801_resume(struct device *dev)
> > >  {
> > > -	struct i801_priv *priv = dev_get_drvdata(dev);
> > > +	struct pci_dev *pci_dev = to_pci_dev(dev);
> > > +	struct i801_priv *priv = pci_get_drvdata(pci_dev);
> > > +	unsigned char hstcfg = i801_setup_hstcfg(priv->original_hstcfg);
> > >  
> > > +	pci_write_config_byte(pci_dev, SMBHSTCFG, hstcfg);  
> > 
> > And on top of that, we could skip the 'hstcfg' variable here.
>
> Add extra parameter of "struct pci_dev*" type in i801_setup_hstcfg().

That was my first approach, yes. But then I tried passing the struct
i801_priv * instead, and it looks even neater to me (but I'm biased
because I did it). I'll post that for review shortly.

> We can
> also skip the introduction of "struct pci_dev*" type variable in .resume()
> then. Just use to_pci_dev(dev) .

I don't really mind keeping the pci_dev variable, for symmetry with
.suspend(), and the compiler will optimize it away anyway. There's a
minor cleanup possible in this area though, to which I'll give a try.

Thanks,
-- 
Jean Delvare
SUSE L3 Support

      reply	other threads:[~2020-09-01  9:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-25 17:13 [PATCH] i2c: i801: Fix resume bug Jean Delvare
2020-08-28  8:57 ` Wolfram Sang
2020-08-28 16:40   ` Bjorn Helgaas
2020-08-31 14:33     ` Jean Delvare
2020-08-31 14:59   ` Vaibhav Gupta
2020-09-01  9:35     ` Jean Delvare [this message]

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=20200901113505.68faaa49@endymion \
    --to=jdelvare@suse.de \
    --cc=helgaas@kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=vaibhavgupta40@gmail.com \
    --cc=vr_qemu@t-online.de \
    --cc=wsa@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 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.