From: lee.jones@linaro.org (Lee Jones)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 6/9] watchdog: st_wdt: Add new driver for ST's LPC Watchdog
Date: Thu, 22 Jan 2015 17:21:00 +0000 [thread overview]
Message-ID: <20150122172100.GF9129@x1> (raw)
In-Reply-To: <54C12F10.4090901@roeck-us.net>
On Thu, 22 Jan 2015, Guenter Roeck wrote:
> On 01/22/2015 03:56 AM, Lee Jones wrote:
> >Signed-off-by: David Paris <david.paris@st.com>
> >Signed-off-by: Lee Jones <lee.jones@linaro.org>
> >---
> > drivers/watchdog/Kconfig | 13 ++
> > drivers/watchdog/Makefile | 1 +
> > drivers/watchdog/st_lpc_wdt.c | 335 ++++++++++++++++++++++++++++++++++++++++++
> > 3 files changed, 349 insertions(+)
> > create mode 100644 drivers/watchdog/st_lpc_wdt.c
[...]
> >+struct st_wdog_syscfg {
> >+ struct regmap *regmap;
>
> Hi David & Lee,
>
> Why did you add the regmap pointer to this structure and not to st_wdog ?
> It is not a configuration value, after all, and it is always dereferenced
> through wt_wdog->syscfg. So all it does is to make the code more complicated.
>
> Am I missing something ?
I guess it was just to group it all together, as it will all be used
at the same time:
regmap_update_bits(st_wdog->syscfg->regmap,
st_wdog->syscfg->reset_type_reg,
st_wdog->syscfg->reset_type_mask,
st_wdog->warm_reset);
It really doesn't matter to me either way.
> >+ unsigned int reset_type_reg;
> >+ unsigned int reset_type_mask;
> >+ unsigned int enable_reg;
> >+ unsigned int enable_mask;
> >+};
> >+
> >+struct st_wdog {
> >+ void __iomem *base;
> >+ struct device *dev;
> >+ struct st_wdog_syscfg *syscfg;
> >+ struct clk *clk;
> >+ unsigned long clkrate;
> >+ bool warm_reset;
> >+};
[...]
> >+static int st_wdog_probe(struct platform_device *pdev)
> >+{
> >+ const struct of_device_id *match;
> >+ struct device_node *np = pdev->dev.of_node;
> >+ struct st_wdog *st_wdog;
> >+ struct regmap *regmap;
> >+ struct resource *res;
> >+ struct clk *clk;
> >+ void __iomem *base;
> >+ uint32_t mode;
> >+ int ret;
> >+
> >+ ret = of_property_read_u32(np, "st,lpc-mode", &mode);
> >+ if (ret) {
> >+ dev_err(&pdev->dev, "An LPC mode must be provided\n");
> >+ return -EINVAL;
> >+ }
> >+
> >+ /* LPC can either run in RTC or WDT mode */
> >+ if (mode != ST_LPC_MODE_WDT)
> >+ return -ENODEV;
> >+
> >+ st_wdog = devm_kzalloc(&pdev->dev, sizeof(*st_wdog), GFP_KERNEL);
> >+ if (!st_wdog)
> >+ return -ENOMEM;
> >+
> >+ match = of_match_device(st_wdog_match, &pdev->dev);
> >+ if (!match) {
> >+ dev_err(&pdev->dev, "Couldn't match device\n");
> >+ return -ENODEV;
> >+ }
> >+ st_wdog->syscfg = (struct st_wdog_syscfg *)match->data;
> >+
> >+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> >+ base = devm_ioremap_resource(&pdev->dev, res);
> >+ if (IS_ERR(base)) {
> >+ dev_err(&pdev->dev, "Failed to ioremap base\n");
>
> devm_ioremap_resource already displays an error message, do this one is unnecessary.
You're right. Will fix.
[...]
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
next prev parent reply other threads:[~2015-01-22 17:21 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-22 11:55 [PATCH v2 0/9] mfd: watchdog: rtc: New driver for ST's LPC IP Lee Jones
2015-01-22 11:55 ` [PATCH v2 1/9] mfd: dt-bindings: Provide human readable defines for LPC mode choosing Lee Jones
2015-01-22 11:56 ` [PATCH v2 2/9] ARM: multi_v7_defconfig: Enable support for ST's LPC Watchdog Lee Jones
2015-01-22 11:56 ` [PATCH v2 3/9] ARM: multi_v7_defconfig: Enable support for ST's LPC RTC Lee Jones
2015-01-22 11:56 ` [PATCH v2 4/9] ARM: STi: DT: STiH407: Add Device Tree node for the LPC Lee Jones
2015-01-23 8:39 ` David Paris
2015-01-23 9:43 ` Lee Jones
2015-02-18 9:34 ` Lee Jones
2015-01-22 11:56 ` [PATCH v2 5/9] watchdog: bindings: Provide ST bindings for ST's LPC Watchdog device Lee Jones
2015-01-22 11:56 ` [PATCH v2 6/9] watchdog: st_wdt: Add new driver for ST's LPC Watchdog Lee Jones
2015-01-22 17:10 ` Guenter Roeck
2015-01-22 17:21 ` Lee Jones [this message]
2015-01-22 19:31 ` Guenter Roeck
2015-01-22 11:56 ` [PATCH v2 7/9] rtc: bindings: Provide ST bindings for ST's LPC RTC device Lee Jones
2015-01-22 11:56 ` [PATCH v2 8/9] rtc: st: add new driver for ST's LPC RTC Lee Jones
2015-01-22 11:56 ` [PATCH v2 9/9] MAINTAINERS: Add Watchdog and RTC files to STI's maintainer entry Lee Jones
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=20150122172100.GF9129@x1 \
--to=lee.jones@linaro.org \
--cc=linux-arm-kernel@lists.infradead.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).