[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2928949.OKYp272uiY@wuerfel>
Date: Mon, 15 Dec 2014 14:38:33 +0100
From: Arnd Bergmann <arnd@...db.de>
To: Lee Jones <lee.jones@...aro.org>
Cc: linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
kernel@...inux.com, a.zummo@...ertech.it,
rtc-linux@...glegroups.com, wim@...ana.be,
linux-watchdog@...r.kernel.org, devicetree@...r.kernel.org
Subject: Re: [PATCH 5/8] mfd: Add ST's Low Power Controller driver
On Monday 15 December 2014 11:25:35 Lee Jones wrote:
> + ret = of_property_read_u32(np, "st,lpc-mode", &mode);
> + if (ret) {
> + dev_err(&pdev->dev, "An LPC mode must be selected\n");
> + return ret;
> + }
> +
> + switch (mode) {
> + case ST_LPC_MODE_RTC:
> + cell->name = "st-lpc-rtc";
> + break;
> + case ST_LPC_MODE_WDT:
> + cell->name = "st-lpc-wdt";
> + break;
> + default:
> + dev_err(&pdev->dev, "Unsupported mode: %d\n", mode);
> + return ret;
> + }
> +
> + /* Pass resources though to selected child device. */
> + cell->resources = pdev->resource;
> + cell->num_resources = pdev->num_resources;
> +
> + ret = mfd_add_devices(&pdev->dev, PLATFORM_DEVID_AUTO,
> + cell, 1, NULL, 0, NULL);
>
I don't think it's necessary to have the MFD node if only one of the
two modes can be used based on a DT property. It should be enough
to have both the rtc and the wdt driver list the same compatible
string and check the property in the probe function to decide if
they want to drive the device or not:
ret = of_property_read_u32(np, "st,lpc-mode", &mode);
if (!ret && mode != ST_LPC_MODE_RTC)
return -ENXIO
Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists