From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16F14C433E3 for ; Mon, 13 Jul 2020 08:59:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D50F72068F for ; Mon, 13 Jul 2020 08:59:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729108AbgGMI7u (ORCPT ); Mon, 13 Jul 2020 04:59:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726077AbgGMI7t (ORCPT ); Mon, 13 Jul 2020 04:59:49 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98CA6C061755 for ; Mon, 13 Jul 2020 01:59:49 -0700 (PDT) Received: from gallifrey.ext.pengutronix.de ([2001:67c:670:201:5054:ff:fe8d:eefb] helo=[127.0.0.1]) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1juuJQ-0005Uk-0a; Mon, 13 Jul 2020 10:59:48 +0200 Subject: Re: [PATCH v1 8/8] watchdog: f71808e_wdt: rename variant-independent identifiers appropriately To: Guenter Roeck Cc: Wim Van Sebroeck , linux-watchdog@vger.kernel.org, kernel@pengutronix.de, linux-kernel@vger.kernel.org References: <20200611191750.28096-1-a.fatoum@pengutronix.de> <20200611191750.28096-9-a.fatoum@pengutronix.de> <20200630212927.GA24643@roeck-us.net> From: Ahmad Fatoum Message-ID: <6a31b919-4142-ba07-09c6-75e56c3050ed@pengutronix.de> Date: Mon, 13 Jul 2020 10:59:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <20200630212927.GA24643@roeck-us.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2001:67c:670:201:5054:ff:fe8d:eefb X-SA-Exim-Mail-From: a.fatoum@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/30/20 11:29 PM, Guenter Roeck wrote: > On Thu, Jun 11, 2020 at 09:17:49PM +0200, Ahmad Fatoum wrote: >> Code for the common parts of the driver, either uses watchdog_ as >> prefix for the watchdog API or f71808e_ for everything else. >> >> The driver now supports 9 more variants besides the f71808e, >> so let's rename the common parts to start with fintek_ instead. >> >> This makes code browsing easier, because it's readily apparent whether a >> function is variant-specific or not. Also the watchdog_ namespace isn't >> used anymore for the driver-internal functions. >> >> Signed-off-by: Ahmad Fatoum >> Reported-by: kernel test robot >> --- >> drivers/watchdog/f71808e_wdt.c | 98 +++++++++++++++++----------------- >> 1 file changed, 49 insertions(+), 49 deletions(-) >> >> diff --git a/drivers/watchdog/f71808e_wdt.c b/drivers/watchdog/f71808e_wdt.c >> index 7c42cbf9912e..c866d05e8788 100644 >> --- a/drivers/watchdog/f71808e_wdt.c >> +++ b/drivers/watchdog/f71808e_wdt.c >> @@ -114,18 +114,18 @@ static inline int superio_enter(int base); >> static inline void superio_select(int base, int ld); >> static inline void superio_exit(int base); >> >> -struct watchdog_data; >> +struct fintek_wdog_data; >> >> -struct f71808e_variant { >> +struct fintek_variant { >> u16 id; >> const char *wdt_name; /* NULL if chip lacks watchdog timer */ >> - void (*pinconf)(struct watchdog_data *wd); >> + void (*pinconf)(struct fintek_wdog_data *wd); >> }; >> >> -struct watchdog_data { >> +struct fintek_wdog_data { >> struct watchdog_device wdd; >> unsigned short sioaddr; >> - const struct f71808e_variant *variant; >> + const struct fintek_variant *variant; >> struct watchdog_info ident; >> >> u8 timer_val; /* content for the wd_time register */ >> @@ -134,7 +134,7 @@ struct watchdog_data { >> char pulse_mode; /* enable pulse output mode? */ >> }; >> >> -static inline bool has_f81865_wdo_conf(struct watchdog_data *wd) >> +static inline bool has_f81865_wdo_conf(struct fintek_wdog_data *wd) >> { >> return wd->variant->id == SIO_F81865_ID >> || wd->variant->id == SIO_F81866_ID; >> @@ -202,9 +202,9 @@ static inline void superio_exit(int base) >> release_region(base, 2); >> } >> >> -static int watchdog_set_timeout(struct watchdog_device *wdd, unsigned int new_timeout) >> +static int fintek_wdog_set_timeout(struct watchdog_device *wdd, unsigned int new_timeout) >> { >> - struct watchdog_data *wd = watchdog_get_drvdata(wdd); >> + struct fintek_wdog_data *wd = watchdog_get_drvdata(wdd); >> >> wdd->timeout = new_timeout; >> if (new_timeout > 0xff) { >> @@ -218,7 +218,7 @@ static int watchdog_set_timeout(struct watchdog_device *wdd, unsigned int new_ti >> return 0; >> } >> >> -static int watchdog_set_pulse_width(struct watchdog_data *wd, unsigned int pw) >> +static int fintek_wdog_set_pulse_width(struct fintek_wdog_data *wd, unsigned int pw) >> { >> unsigned int t1 = 25, t2 = 125, t3 = 5000; >> >> @@ -246,9 +246,9 @@ static int watchdog_set_pulse_width(struct watchdog_data *wd, unsigned int pw) >> return 0; >> } >> >> -static int watchdog_keepalive(struct watchdog_device *wdd) >> +static int fintek_wdog_keepalive(struct watchdog_device *wdd) >> { >> - struct watchdog_data *wd = watchdog_get_drvdata(wdd); >> + struct fintek_wdog_data *wd = watchdog_get_drvdata(wdd); >> int err; >> >> err = superio_enter(wd->sioaddr); >> @@ -274,13 +274,13 @@ static int watchdog_keepalive(struct watchdog_device *wdd) >> return 0; >> } >> >> -static int watchdog_start(struct watchdog_device *wdd) >> +static int fintek_wdog_start(struct watchdog_device *wdd) >> { >> - struct watchdog_data *wd = watchdog_get_drvdata(wdd); >> + struct fintek_wdog_data *wd = watchdog_get_drvdata(wdd); >> int err; >> >> /* Make sure we don't die as soon as the watchdog is enabled below */ >> - err = watchdog_keepalive(wdd); >> + err = fintek_wdog_keepalive(wdd); >> if (err) >> return err; >> >> @@ -328,9 +328,9 @@ static int watchdog_start(struct watchdog_device *wdd) >> return err; >> } >> >> -static int watchdog_stop(struct watchdog_device *wdd) >> +static int fintek_wdog_stop(struct watchdog_device *wdd) >> { >> - struct watchdog_data *wd = watchdog_get_drvdata(wdd); >> + struct fintek_wdog_data *wd = watchdog_get_drvdata(wdd); >> int err; >> >> err = superio_enter(wd->sioaddr); >> @@ -346,21 +346,21 @@ static int watchdog_stop(struct watchdog_device *wdd) >> return 0; >> } >> >> -static const struct watchdog_ops f71808e_wdog_ops = { >> +static const struct watchdog_ops fintek_wdog_ops = { >> .owner = THIS_MODULE, >> - .start = watchdog_start, >> - .stop = watchdog_stop, >> - .ping = watchdog_keepalive, >> - .set_timeout = watchdog_set_timeout, >> + .start = fintek_wdog_start, >> + .stop = fintek_wdog_stop, >> + .ping = fintek_wdog_keepalive, >> + .set_timeout = fintek_wdog_set_timeout, >> }; >> >> -static bool watchdog_is_running(struct watchdog_data *wd, u8 wdt_conf) >> +static bool fintek_wdog_is_running(struct fintek_wdog_data *wd, u8 wdt_conf) >> { >> return (superio_inb(wd->sioaddr, SIO_REG_ENABLE) & BIT(0)) >> && (wdt_conf & BIT(F71808FG_FLAG_WD_EN)); >> } >> >> -static int __init watchdog_init(struct watchdog_data *wd) >> +static int __init fintek_wdog_init(struct fintek_wdog_data *wd) >> { >> struct watchdog_device *wdd = &wd->wdd; >> int wdt_conf, err = 0; >> @@ -390,17 +390,17 @@ static int __init watchdog_init(struct watchdog_data *wd) >> superio_outb(wd->sioaddr, F71808FG_REG_WDT_CONF, >> wdt_conf | BIT(F71808FG_FLAG_WDTMOUT_STS)); >> >> - if (watchdog_is_running(wd, wdt_conf)) >> + if (fintek_wdog_is_running(wd, wdt_conf)) >> set_bit(WDOG_HW_RUNNING, &wdd->status); >> >> superio_exit(wd->sioaddr); >> >> - err = watchdog_set_pulse_width(wd, pulse_width); >> + err = fintek_wdog_set_pulse_width(wd, pulse_width); >> if (err) >> return err; >> >> wdd->info = &wd->ident; >> - wdd->ops = &f71808e_wdog_ops; >> + wdd->ops = &fintek_wdog_ops; >> wdd->min_timeout = 1; >> wdd->max_timeout = max_timeout; >> wdd->timeout = timeout; >> @@ -418,18 +418,18 @@ static int __init watchdog_init(struct watchdog_data *wd) >> * WATCHDOG_HANDLE_BOOT_ENABLED can result in keepalive being directly >> * called without a set_timeout before, so it needs to be done here once >> */ >> - watchdog_set_timeout(wdd, wdd->timeout); >> + fintek_wdog_set_timeout(wdd, wdd->timeout); >> >> return watchdog_register_device(wdd); >> } >> >> -static void f71808fg_pinconf(struct watchdog_data *wd) >> +static void f71808fg_pinconf(struct fintek_wdog_data *wd) >> { >> /* Set pin 21 to GPIO23/WDTRST#, then to WDTRST# */ >> superio_clear_bit(wd->sioaddr, SIO_REG_MFUNCT2, 3); >> superio_clear_bit(wd->sioaddr, SIO_REG_MFUNCT3, 3); >> } >> -static void f71862fg_pinconf(struct watchdog_data *wd) >> +static void f71862fg_pinconf(struct fintek_wdog_data *wd) >> { >> if (f71862fg_pin == 63) { >> /* SPI must be disabled first to use this pin! */ >> @@ -439,23 +439,23 @@ static void f71862fg_pinconf(struct watchdog_data *wd) >> superio_set_bit(wd->sioaddr, SIO_REG_MFUNCT1, 1); >> } >> } >> -static void f71868_pinconf(struct watchdog_data *wd) >> +static void f71868_pinconf(struct fintek_wdog_data *wd) >> { >> /* GPIO14 --> WDTRST# */ >> superio_clear_bit(wd->sioaddr, SIO_REG_MFUNCT1, 4); >> } >> -static void f71882fg_pinconf(struct watchdog_data *wd) >> +static void f71882fg_pinconf(struct fintek_wdog_data *wd) >> { >> /* Set pin 56 to WDTRST# */ >> superio_set_bit(wd->sioaddr, SIO_REG_MFUNCT1, 1); >> } >> -static void f71889fg_pinconf(struct watchdog_data *wd) >> +static void f71889fg_pinconf(struct fintek_wdog_data *wd) >> { >> /* set pin 40 to WDTRST# */ >> superio_outb(wd->sioaddr, SIO_REG_MFUNCT3, >> superio_inb(wd->sioaddr, SIO_REG_MFUNCT3) & 0xcf); >> } >> -static void f81803_pinconf(struct watchdog_data *wd) >> +static void f81803_pinconf(struct fintek_wdog_data *wd) >> { >> /* Enable TSI Level register bank */ >> superio_clear_bit(wd->sioaddr, SIO_REG_CLOCK_SEL, 3); >> @@ -463,12 +463,12 @@ static void f81803_pinconf(struct watchdog_data *wd) >> superio_outb(wd->sioaddr, SIO_REG_TSI_LEVEL_SEL, 0x5f & >> superio_inb(wd->sioaddr, SIO_REG_TSI_LEVEL_SEL)); >> } >> -static void f81865_pinconf(struct watchdog_data *wd) >> +static void f81865_pinconf(struct fintek_wdog_data *wd) >> { >> /* Set pin 70 to WDTRST# */ >> superio_clear_bit(wd->sioaddr, SIO_REG_MFUNCT3, 5); >> } >> -static void f81866_pinconf(struct watchdog_data *wd) >> +static void f81866_pinconf(struct fintek_wdog_data *wd) >> { >> /* >> * GPIO1 Control Register when 27h BIT3:2 = 01 & BIT0 = 0. >> @@ -484,7 +484,7 @@ static void f81866_pinconf(struct watchdog_data *wd) >> superio_clear_bit(wd->sioaddr, SIO_F81866_REG_GPIO1, 5); >> } >> >> -struct f71808e_variant f71808e_variants[] = { >> +struct fintek_variant fintek_variants[] = { > > 0-day has a point here. Granted, that is inherited, but still ... Ye, will fix in v2. Was just waiting for more review. Thanks, Ahmad > >> { SIO_F71808_ID, "f71808fg", f71808fg_pinconf }, >> { SIO_F71862_ID, "f71862fg", f71862fg_pinconf }, >> { SIO_F71868_ID, "f71868", f71868_pinconf }, >> @@ -500,9 +500,9 @@ struct f71808e_variant f71808e_variants[] = { >> { /* sentinel */ } >> }; >> >> -static struct f71808e_variant __init *f71808e_find(int sioaddr) >> +static struct fintek_variant __init *fintek_wdog_find(int sioaddr) >> { >> - struct f71808e_variant *variant; >> + struct fintek_variant *variant; >> u16 devid; >> int err = superio_enter(sioaddr); >> if (err) >> @@ -516,7 +516,7 @@ static struct f71808e_variant __init *f71808e_find(int sioaddr) >> } >> >> devid = force_id ? force_id : superio_inw(sioaddr, SIO_REG_DEVID); >> - for (variant = f71808e_variants; variant->id; variant++) { >> + for (variant = fintek_variants; variant->id; variant++) { >> if (variant->id == devid) >> break; >> } >> @@ -536,13 +536,13 @@ static struct f71808e_variant __init *f71808e_find(int sioaddr) >> return variant; >> } >> >> -static struct watchdog_data watchdog; >> +static struct fintek_wdog_data watchdog; >> >> -static int __init f71808e_init(void) >> +static int __init fintek_wdog_probe(void) >> { >> - struct watchdog_data *wd = &watchdog; >> + struct fintek_wdog_data *wd = &watchdog; >> static const unsigned short addrs[] = { 0x2e, 0x4e }; >> - struct f71808e_variant *variant; >> + struct fintek_variant *variant; >> int i; >> >> if (f71862fg_pin != 63 && f71862fg_pin != 56) { >> @@ -551,7 +551,7 @@ static int __init f71808e_init(void) >> } >> >> for (i = 0; i < ARRAY_SIZE(addrs); i++) { >> - variant = f71808e_find(addrs[i]); >> + variant = fintek_wdog_find(addrs[i]); >> if (!IS_ERR(variant)) >> break; >> } >> @@ -561,17 +561,17 @@ static int __init f71808e_init(void) >> wd->variant = variant; >> wd->sioaddr = addrs[i]; >> >> - return watchdog_init(wd); >> + return fintek_wdog_init(wd); >> } >> >> -static void __exit f71808e_exit(void) >> +static void __exit fintek_wdog_exit(void) >> { >> watchdog_unregister_device(&watchdog.wdd); >> } >> >> -MODULE_DESCRIPTION("F71808E Watchdog Driver"); >> +MODULE_DESCRIPTION("Fintek F71808E Watchdog Driver"); >> MODULE_AUTHOR("Giel van Schijndel "); >> MODULE_LICENSE("GPL"); >> >> -module_init(f71808e_init); >> -module_exit(f71808e_exit); >> +module_init(fintek_wdog_probe); >> +module_exit(fintek_wdog_exit); > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |