mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@nxp.com>
To: Haibo Chen <haibo.chen@nxp.com>,
	Jonathan Cameron <jic23@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	"open list:NXP i.MX 7D/6SX/6UL/93 AND VF610 ADC DRIVER"
	<linux-iio@vger.kernel.org>,
	"open list:NXP i.MX 7D/6SX/6UL/93 AND VF610 ADC DRIVER"
	<imx@lists.linux.dev>, open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v6 2/2] iio: adc: vf610_adc: limit i.MX6SX's channel number to 4
Date: Fri, 6 Dec 2024 18:00:24 -0500	[thread overview]
Message-ID: <Z1OCCP7MlucJ9F73@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20241206225624.3744880-4-Frank.Li@nxp.com>

On Fri, Dec 06, 2024 at 05:56:24PM -0500, Frank Li wrote:
> i.MX6SX only has 4 ADC channels, so limit channel numbers to 4 for
> compatible string 'fsl,imx6sx-adc'.

This patch already in linux-next, send out accidently. please forget it.
sorry for that.

Frank

>
> Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
> Signed-off-by: Frank Li <Frank.Li@nxp.com>
> ---
> compatible string 'fsl,imx6sx-adc' already document in
> Documentation/devicetree/bindings/iio/adc/fsl,vf610-adc.yaml
> Change from v5 to v6
> - remove return value check of device_get_match_data() and move it to
> declare place.
>
> Change from v4 to v5
> - none
>
> Change from v3 to v4
> - Add struct vf610_chip_info to avoid cast int to void*
>
> Change from v2 to v3
> - none
>
> Change from v1 to v2
> - Add Haibo Chen <haibo.chen@nxp.com>
> - change cast to uintptr_t to fix below warning
>
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202411052345.gyJaM3h4-lkp@intel.com/
> All warnings (new ones prefixed by >>):
>
>    In file included from drivers/iio/adc/vf610_adc.c:20:   In file included from include/linux/regulator/consumer.h:35:
>    In file included from include/linux/suspend.h:5:
>    In file included from include/linux/swap.h:9:
>    In file included from include/linux/memcontrol.h:21:
>    In file included from include/linux/mm.h:2213:
>    include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
>      518 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
>          |                               ~~~~~~~~~~~ ^ ~~~>> drivers/iio/adc/vf610_adc.c:874:28: warning: cast to smaller integer type 'u32' (aka 'unsigned int') from 'const void *' [-Wvoid-pointer-to-int-cast]
>      874 |         indio_dev->num_channels = (u32)device_get_match_data(dev);
>          |
> ---
>  drivers/iio/adc/vf610_adc.c | 18 ++++++++++++++++--
>  1 file changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/adc/vf610_adc.c b/drivers/iio/adc/vf610_adc.c
> index fb7afa91151f2..850453be7a8a4 100644
> --- a/drivers/iio/adc/vf610_adc.c
> +++ b/drivers/iio/adc/vf610_adc.c
> @@ -177,6 +177,10 @@ struct vf610_adc {
>  	} scan;
>  };
>
> +struct vf610_chip_info {
> +	u8 num_channels;
> +};
> +
>  static const u32 vf610_hw_avgs[] = { 1, 4, 8, 16, 32 };
>  static const u32 vf610_lst_adder[] = { 3, 5, 7, 9, 13, 17, 21, 25 };
>
> @@ -808,8 +812,17 @@ static const struct iio_info vf610_adc_iio_info = {
>  	.attrs = &vf610_attribute_group,
>  };
>
> +static const struct vf610_chip_info vf610_chip_info = {
> +	.num_channels = ARRAY_SIZE(vf610_adc_iio_channels),
> +};
> +
> +static const struct vf610_chip_info imx6sx_chip_info = {
> +	.num_channels = 4,
> +};
> +
>  static const struct of_device_id vf610_adc_match[] = {
> -	{ .compatible = "fsl,vf610-adc", },
> +	{ .compatible = "fsl,imx6sx-adc", .data = &imx6sx_chip_info},
> +	{ .compatible = "fsl,vf610-adc", .data = &vf610_chip_info},
>  	{ /* sentinel */ }
>  };
>  MODULE_DEVICE_TABLE(of, vf610_adc_match);
> @@ -824,6 +837,7 @@ static void vf610_adc_action_remove(void *d)
>  static int vf610_adc_probe(struct platform_device *pdev)
>  {
>  	struct device *dev = &pdev->dev;
> +	const struct vf610_chip_info *chip_info = device_get_match_data(dev);
>  	struct vf610_adc *info;
>  	struct iio_dev *indio_dev;
>  	int irq;
> @@ -881,7 +895,7 @@ static int vf610_adc_probe(struct platform_device *pdev)
>  	indio_dev->info = &vf610_adc_iio_info;
>  	indio_dev->modes = INDIO_DIRECT_MODE;
>  	indio_dev->channels = vf610_adc_iio_channels;
> -	indio_dev->num_channels = ARRAY_SIZE(vf610_adc_iio_channels);
> +	indio_dev->num_channels = chip_info->num_channels;
>
>  	vf610_adc_cfg_init(info);
>  	vf610_adc_hw_init(info);
> --
> 2.34.1
>

  reply	other threads:[~2024-12-06 23:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-06 22:56 [PATCH 1/2] thermal/drivers/qoriq: Use dev_err_probe() simplify the code Frank Li
2024-12-06 22:56 ` [PATCH 2/2] thermal/drivers/qoriq: Power down TMU on system suspend Frank Li
2024-12-06 22:56 ` [PATCH v6 1/2] iio: adc: vf610_adc: use devm_* and dev_err_probe() to simple code Frank Li
2024-12-06 22:59   ` Frank Li
2024-12-06 22:56 ` [PATCH v6 2/2] iio: adc: vf610_adc: limit i.MX6SX's channel number to 4 Frank Li
2024-12-06 23:00   ` Frank Li [this message]
2024-12-06 23:18 ` [PATCH 1/2] thermal/drivers/qoriq: Use dev_err_probe() simplify the code Christophe JAILLET

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=Z1OCCP7MlucJ9F73@lizhi-Precision-Tower-5810 \
    --to=frank.li@nxp.com \
    --cc=haibo.chen@nxp.com \
    --cc=imx@lists.linux.dev \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®