public inbox for linux-clk@vger.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: Andreas Kemnade <andreas@kemnade.info>
Cc: Roger Quadros <rogerq@kernel.org>,
	linux-omap@vger.kernel.org, Stephen Boyd <sboyd@kernel.org>,
	Kevin Hilman <khilman@baylibre.com>,
	Michael Turquette <mturquette@baylibre.com>,
	Aaro Koskinen <aaro.koskinen@iki.fi>,
	linux-kernel@vger.kernel.org, Tony Lindgren <tony@atomide.com>,
	linux-clk@vger.kernel.org
Subject: Re: [PATCH 1/2] mfd: twl-core: Add a clock subdevice for the TWL6030
Date: Wed, 9 Oct 2024 14:22:49 +0100	[thread overview]
Message-ID: <20241009132249.GH276481@google.com> (raw)
In-Reply-To: <20240924103609.12513-2-andreas@kemnade.info>

On Tue, 24 Sep 2024, Andreas Kemnade wrote:

> Also the TWL6030 has some clocks, so add a subdevice for that.
> 
> Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
> ---
>  drivers/mfd/twl-core.c | 32 ++++++++++++++++++++++----------
>  1 file changed, 22 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
> index c130ffef182f..c981922f62d5 100644
> --- a/drivers/mfd/twl-core.c
> +++ b/drivers/mfd/twl-core.c
> @@ -711,6 +711,10 @@ static struct of_dev_auxdata twl_auxdata_lookup[] = {
>  	{ /* sentinel */ },
>  };
>  
> +static const struct mfd_cell twl6030_cells[] = {
> +	{ .name = "twl6030-clk" },
> +};
> +
>  static const struct mfd_cell twl6032_cells[] = {
>  	{ .name = "twl6032-clk" },
>  };
> @@ -861,17 +865,25 @@ twl_probe(struct i2c_client *client)
>  				 TWL4030_DCDC_GLOBAL_CFG);
>  	}
>  
> -	if (id->driver_data == (TWL6030_CLASS | TWL6032_SUBCLASS)) {
> -		status = devm_mfd_add_devices(&client->dev,
> -					      PLATFORM_DEVID_NONE,
> -					      twl6032_cells,
> -					      ARRAY_SIZE(twl6032_cells),
> -					      NULL, 0, NULL);
> -		if (status < 0)
> -			goto free;
> -	}
> -
>  	if (twl_class_is_6030()) {
> +		if (id->driver_data & TWL6032_SUBCLASS) {
> +			status = devm_mfd_add_devices(&client->dev,
> +						      PLATFORM_DEVID_NONE,
> +						      twl6032_cells,
> +						      ARRAY_SIZE(twl6032_cells),
> +						      NULL, 0, NULL);
> +			if (status < 0)
> +				goto free;
> +		} else {
> +			status = devm_mfd_add_devices(&client->dev,
> +						      PLATFORM_DEVID_NONE,
> +						      twl6030_cells,
> +						      ARRAY_SIZE(twl6030_cells),
> +						      NULL, 0, NULL);
> +			if (status < 0)
> +				goto free;
> +		}
> +

Before this gets too crazy, how about:

> +		if (id->driver_data & TWL6032_SUBCLASS) {
> +			cells = twl6032_cells;
> +			num_cells = ARRAY_SIZE(twl6032_cells);
> +		} else {
> +			cells = twl6030_cells;
> +			num_cells = ARRAY_SIZE(twl6030_cells);
> +		}
> +
> +		status = devm_mfd_add_devices(&client->dev, PLATFORM_DEVID_NONE,
> +					      cells, num_cells, NULL, 0, NULL);
> +		if (status < 0)
> +			goto free;


>  		if (of_device_is_system_power_controller(node)) {
>  			if (!pm_power_off)
>  				pm_power_off = twl6030_power_off;
> -- 
> 2.39.5
> 

-- 
Lee Jones [李琼斯]

  parent reply	other threads:[~2024-10-09 13:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-24 10:36 [PATCH 0/2] mfd: twl: Add clock for TWL6030 Andreas Kemnade
2024-09-24 10:36 ` [PATCH 1/2] mfd: twl-core: Add a clock subdevice for the TWL6030 Andreas Kemnade
2024-09-25  6:52   ` Roger Quadros
2024-10-09 13:22   ` Lee Jones [this message]
2024-09-24 10:36 ` [PATCH 2/2] clk: twl: add TWL6030 support Andreas Kemnade
2024-09-25  7:07   ` Roger Quadros
2024-09-25 10:12     ` Andreas Kemnade

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=20241009132249.GH276481@google.com \
    --to=lee@kernel.org \
    --cc=aaro.koskinen@iki.fi \
    --cc=andreas@kemnade.info \
    --cc=khilman@baylibre.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=rogerq@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=tony@atomide.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