From: Guenter Roeck <guenter.roeck@ericsson.com>
To: Aaron Sierra <asierra@xes-inc.com>
Cc: Jean Delvare <khali@linux-fr.org>,
Grant Likely <grant.likely@secretlab.ca>,
LKML <linux-kernel@vger.kernel.org>,
Peter Tyser <ptyser@xes-inc.com>
Subject: Re: [PATCH 1/3 v2] mfd: Add LPC driver for Intel ICH chipsets
Date: Tue, 7 Feb 2012 13:09:08 -0800 [thread overview]
Message-ID: <1328648948.2261.309.camel@groeck-laptop> (raw)
In-Reply-To: <107b5c23-51b0-4365-ae8c-810fb380a707@zimbra>
On Tue, 2012-02-07 at 16:00 -0500, Aaron Sierra wrote:
> > > +static int __devinit lpc_ich_probe(struct pci_dev *dev,
> > > + const struct pci_device_id *id)
> > > +{
> > > + u32 base_addr_cfg;
> > > + u32 base_addr;
> > > + u8 reg_save;
> > > + int ret;
> > > + int cells = 0;
> > > + int acpi_conflict = 0;
> > > +
> > You can use bool for acpi_conflict (and cells, but I don't think that
> > is needed anyway).
>
> I agree that bool is a better type choice. See my comment at the end
> regarding my reason for using cells.
>
>
> > > +pm_done:
> > > + /* Setup GPIO base register */
> > > + pci_read_config_dword(dev, GPIOBASE, &base_addr_cfg);
> > > + base_addr = base_addr_cfg & 0x0000ff80;
> > > + if (!base_addr) {
> > > + dev_err(&dev->dev, "I/O space for GPIO
> > > uninitialized\n");
> > > + /* GPIO in power-management space may still be
> > > available */
> > > + goto gpio_reg;
> > > + }
> > > +
> > > + gpio_ich_res[ICH_RES_GPIO].start = base_addr;
> > > + gpio_ich_res[ICH_RES_GPIO].end = base_addr +
> > > GPIOBASE_IO_SIZE - 1;
> > > + ret =
> > > acpi_check_resource_conflict(&gpio_ich_res[ICH_RES_GPIO]);
> > > + if (ret) {
> > > + /* this isn't necessarily fatal for the GPIO */
> > > + gpio_ich_res[ICH_RES_GPIO].start = 0;
> > > + gpio_ich_res[ICH_RES_GPIO].end = 0;
> > > + acpi_conflict++;
> >
> > acpi_conflict = true;
> >
> > After all, it does not really matter how many conflicts were
> > detected.
>
> I agree.
>
> > > +gpio_reg:
> > > + lpc_ich_finalize_cell(&lpc_ich_cells[LPC_GPIO], id);
> > > + ret = mfd_add_devices(&dev->dev, 0,
> > > &lpc_ich_cells[LPC_GPIO],
> > > + 1, NULL, 0);
> > > + if (!ret)
> > > + cells++;
> > > +
> > So if there is an error, ret < 0, correct ?
> >
> > > + if (acpi_conflict)
> > > + dev_info(&dev->dev, "ACPI resource conflicts found;
> > > "
> > > + "consider using
> > > acpi_enforce_resources=lax?\n");
> > > +
> > > + if (cells)
> > > + return 0;
> > > + else
> > > + return -ENODEV;
> >
> > If the above is true, you can just return ret, and you don't need the
> > cells variable. Or, even better, move the acpi warning above the call
> > to mfd_add_devices().
>
> The cells variable isn't strictly necessary when we're only dealing
> with one cell registration, as we have if only looking at the lpc_ich
> and gpio-ich patches. The iTCO_wdt patch adds a second call to
> mfd_add_devices, so when we return we're interested if either of the
> calls succeeded. This was intended to be a forward thinking
> implementation, but I have no qualms about simplifying it in the
> initial lpc_ich patch.
No, just keep it - I realized that when I looked into the iTCO patch.
Thanks,
Guenter
next prev parent reply other threads:[~2012-02-07 21:10 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-19 12:53 [PATCH] gpio: New driver for the Intel 82801 (ICH) GPIO pins Jean Delvare
2011-04-19 14:44 ` Grant Likely
2011-04-19 14:54 ` Alan Cox
2011-04-19 15:05 ` Grant Likely
2011-04-19 15:57 ` Alan Cox
2011-04-19 16:40 ` Anton Vorontsov
2011-04-19 17:08 ` Alan Cox
2011-04-19 20:30 ` Anton Vorontsov
2011-04-19 21:16 ` Alan Cox
2011-04-19 21:20 ` Alan Cox
2011-04-23 13:45 ` Jean Delvare
2011-04-23 14:47 ` Alan Cox
2011-05-19 11:33 ` Jean Delvare
2011-05-27 3:09 ` Grant Likely
2012-02-02 2:31 ` Guenter Roeck
2012-02-02 7:49 ` Jean Delvare
2012-02-02 17:35 ` Guenter Roeck
2012-02-02 19:56 ` Peter Tyser
2012-02-02 22:02 ` Guenter Roeck
2012-02-02 23:25 ` [PATCH 1/3] mfd: Add LPC driver for Intel ICH chipsets Aaron Sierra
2012-02-03 6:43 ` Guenter Roeck
2012-02-03 15:34 ` Aaron Sierra
2012-02-03 19:14 ` Guenter Roeck
2012-02-03 19:35 ` Aaron Sierra
2012-02-03 19:45 ` Guenter Roeck
2012-02-03 22:50 ` Aaron Sierra
2012-02-04 8:45 ` Jean Delvare
2012-02-04 16:45 ` Guenter Roeck
2012-02-07 19:56 ` [PATCH 1/3 v2] " Aaron Sierra
2012-02-07 20:15 ` Guenter Roeck
2012-02-07 20:31 ` Jean Delvare
2012-02-07 20:43 ` Guenter Roeck
2012-02-07 21:00 ` Aaron Sierra
2012-02-07 21:09 ` Guenter Roeck [this message]
2012-02-02 23:27 ` [PATCH 2/3] gpio: Add support for Intel ICHx/3100/Series[56] GPIO Aaron Sierra
2012-02-03 20:19 ` Guenter Roeck
2012-02-07 19:58 ` [PATCH 2/3 v2] " Aaron Sierra
2012-02-07 20:42 ` Guenter Roeck
2012-02-07 22:07 ` Jean Delvare
2012-02-07 23:25 ` Aaron Sierra
2012-02-02 23:29 ` [PATCH 3/3] watchdog: Convert iTCO_wdt driver to mfd model Aaron Sierra
2012-02-07 19:59 ` [PATCH 3/3 v2] " Aaron Sierra
2012-02-07 21:07 ` Guenter Roeck
2012-02-08 17:48 ` Aaron Sierra
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=1328648948.2261.309.camel@groeck-laptop \
--to=guenter.roeck@ericsson.com \
--cc=asierra@xes-inc.com \
--cc=grant.likely@secretlab.ca \
--cc=khali@linux-fr.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ptyser@xes-inc.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox