Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Sergio Paracuellos <sergio.paracuellos@gmail.com>,
	linux-watchdog@vger.kernel.org
Cc: wim@linux-watchdog.org, linux@roeck-us.net, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, matthias.bgg@gmail.com,
	arinc.unal@arinc9.com, tsbogend@alpha.franken.de,
	p.zabel@pengutronix.de, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org, linux-mips@vger.kernel.org
Subject: Re: [PATCH 3/3] watchdog: mt7621-wdt: avoid globals and arch dependencies
Date: Fri, 10 Feb 2023 12:02:41 +0100	[thread overview]
Message-ID: <21af8c63-f489-8c3f-e1e3-cf976b1d20d0@linaro.org> (raw)
In-Reply-To: <20230210065621.598120-4-sergio.paracuellos@gmail.com>

On 10/02/2023 07:56, Sergio Paracuellos wrote:
> MT7621 SoC has a system controller node. Watchdog need to access to reset
> status register. Ralink architecture and related driver are old and from
> the beggining they ar providing some architecture dependent operations
> for accessing this shared registers through 'asm/mach-ralink/ralink_regs.h'
> header file. However this is not ideal from a driver perspective which can
> just access to the system controller registers in am arch independent way
> using regmap syscon APIs. Hence, add a new structure for driver data and
> use it along the code. This way architecture dependencies and global vars
> are not needed anymore. Update Kconfig accordingly to select new added
> dependencies and allow driver to be compile tested.
> 
> Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
> ---
>  drivers/watchdog/Kconfig      |   4 +-
>  drivers/watchdog/mt7621_wdt.c | 121 ++++++++++++++++++++++------------
>  2 files changed, 83 insertions(+), 42 deletions(-)
> 


> -
>  static int mt7621_wdt_probe(struct platform_device *pdev)
>  {
> +	struct device_node *np = pdev->dev.of_node;
>  	struct device *dev = &pdev->dev;
> -	mt7621_wdt_base = devm_platform_ioremap_resource(pdev, 0);
> -	if (IS_ERR(mt7621_wdt_base))
> -		return PTR_ERR(mt7621_wdt_base);
> +	struct watchdog_device *mt7621_wdt;
> +	struct mt7621_wdt_data *drvdata;
> +	int err;
> +
> +	drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
> +	if (!drvdata)
> +		return -ENOMEM;
>  
> -	mt7621_wdt_reset = devm_reset_control_get_exclusive(dev, NULL);
> -	if (!IS_ERR(mt7621_wdt_reset))
> -		reset_control_deassert(mt7621_wdt_reset);
> +	drvdata->sysc = syscon_regmap_lookup_by_phandle(np, "ralink,sysctl");
> +	if (IS_ERR(drvdata->sysc))
> +		return PTR_ERR(drvdata->sysc);

You claim in commit title that you remove some global usage, but you add
here several new features and refactor the code significantly. You need
to split refactorings, improvements from completely new features. The
entire patch is very difficult to understand in current form.

Best regards,
Krzysztof


  reply	other threads:[~2023-02-10 11:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-10  6:56 [PATCH 0/3] watchdog: mt7621-wdt: avoid globals and arch dependencies Sergio Paracuellos
2023-02-10  6:56 ` [PATCH 1/3] dt-bindings: watchdog: mt7621-wdt: add phandle to access system controller registers Sergio Paracuellos
2023-02-10 10:59   ` Krzysztof Kozlowski
2023-02-10 11:22     ` Sergio Paracuellos
2023-02-10 11:27       ` Krzysztof Kozlowski
2023-02-10 11:38         ` Sergio Paracuellos
2023-02-10  6:56 ` [PATCH 2/3] mips: dts: ralink: mt7621: add phandle to system controller node for watchdog Sergio Paracuellos
2023-02-10 11:00   ` Krzysztof Kozlowski
2023-02-10 11:29     ` Sergio Paracuellos
2023-02-10 11:31       ` Krzysztof Kozlowski
2023-02-10 11:37         ` Sergio Paracuellos
2023-02-10  6:56 ` [PATCH 3/3] watchdog: mt7621-wdt: avoid globals and arch dependencies Sergio Paracuellos
2023-02-10 11:02   ` Krzysztof Kozlowski [this message]
2023-02-10 11:35     ` Sergio Paracuellos
2023-02-10 12:04       ` Krzysztof Kozlowski

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=21af8c63-f489-8c3f-e1e3-cf976b1d20d0@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=arinc.unal@arinc9.com \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=matthias.bgg@gmail.com \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.org \
    --cc=sergio.paracuellos@gmail.com \
    --cc=tsbogend@alpha.franken.de \
    --cc=wim@linux-watchdog.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