mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Daniel Lezcano <daniel.lezcano@linaro.org>,
	jic23@kernel.org, dlechner@baylibre.com, nuno.sa@analog.com,
	andy@kernel.org, robh@kernel.org, conor+dt@kernel.org,
	krzk+dt@kernel.org
Cc: linux-iio@vger.kernel.org, s32@nxp.com,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	chester62515@gmail.com, mbrugger@suse.com,
	ghennadi.procopciuc@oss.nxp.com
Subject: Re: [PATCH v1 2/2] iio: adc: Add the NXP SAR ADC support for the s32g2/3 platforms
Date: Sat, 6 Sep 2025 09:34:11 +0200	[thread overview]
Message-ID: <6988c5d0-796a-4ab0-88d5-7051c80b5bba@kernel.org> (raw)
In-Reply-To: <20250903102756.1748596-3-daniel.lezcano@linaro.org>

On 03/09/2025 12:27, Daniel Lezcano wrote:
> +#include <linux/dmaengine.h>
> +#include <linux/interrupt.h>
> +#include <linux/iopoll.h>
> +#include <linux/module.h>
> +#include <linux/of_irq.h>

Unused header

> +#include <linux/of_platform.h>

This as well. OTOH, you actually miss the header you use - of.h.

> +#include <linux/platform_device.h>
> +#include <linux/slab.h>
> +
> +#include <linux/iio/iio.h>
> +#include <linux/iio/triggered_buffer.h>
> +#include <linux/iio/trigger_consumer.h>
> +
> +/* This will be the driver name the kernel reports */
> +#define DRIVER_NAME "nxp-sar-adc"
> +
> +/* SAR ADC registers */
> +#define REG_ADC_CDR(__base, __channel)	(((__base) + 0x100) + ((__channel) * 0x4))
> +
> +#define REG_ADC_CDR_CDATA_MASK		GENMASK(11, 0)
> +#define REG_ADC_CDR_VALID		BIT(19)
> +
> +/* Main Configuration Register */
> +#define REG_ADC_MCR(__base)		(__base)
> +

...

> +	indio_dev->name = dev_name(dev);
> +	indio_dev->info = &nxp_sar_adc_iio_info;
> +	indio_dev->modes = INDIO_DIRECT_MODE | INDIO_BUFFER_SOFTWARE;
> +	indio_dev->channels = nxp_sar_adc_iio_channels;
> +	indio_dev->num_channels = ARRAY_SIZE(nxp_sar_adc_iio_channels);
> +
> +	nxp_sar_adc_set_default_values(info);
> +
> +	ret = nxp_sar_adc_calibration(info);
> +	if (ret) {
> +		dev_err(dev, "Calibration failed: %d\n", ret);
> +		return ret;
> +	}
> +
> +	ret = nxp_sar_adc_dma_probe(dev, info);
> +	if (ret) {
> +		dev_err(dev, "Failed to initialize the dma\n");

return dev_err_probe

> +		return ret;
> +	}
> +
> +	ret = devm_iio_triggered_buffer_setup(dev, indio_dev,
> +					      &iio_pollfunc_store_time,
> +					      &nxp_sar_adc_trigger_handler,
> +					      &iio_triggered_buffer_setup_ops);
> +	if (ret < 0) {
> +		dev_err(dev, "Couldn't initialise the buffer\n");
> +		return ret;

return dev_err_probe. No need to print ENOMEM errors.


> +	}
> +
> +	ret = devm_iio_device_register(dev, indio_dev);
> +	if (ret) {
> +		dev_err(dev, "Couldn't register the device.\n");

return dev_err_probe

> +		return ret;
> +	}
> +
> +	dev_info(dev, "Device initialized successfully.\n");

Drivers should be silent on success and kernel already gives you
information that device probed (or did not).

Drop.

Best regards,
Krzysztof

      parent reply	other threads:[~2025-09-06  7:34 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-03 10:27 [PATCH v1 0/2] NXP SAR ADC IIO driver for " Daniel Lezcano
2025-09-03 10:27 ` [PATCH v1 1/2] dt-bindings: iio: adc: Add the NXP SAR ADC " Daniel Lezcano
2025-09-03 21:52   ` Rob Herring (Arm)
2025-09-04 19:47   ` David Lechner
2025-09-06  7:29   ` Krzysztof Kozlowski
2025-09-03 10:27 ` [PATCH v1 2/2] iio: adc: Add the NXP SAR ADC support for the " Daniel Lezcano
2025-09-03 11:20   ` Nuno Sá
2025-09-03 14:53     ` Daniel Lezcano
2025-09-03 15:41     ` Jonathan Cameron
2025-09-04 17:40     ` Daniel Lezcano
2025-09-04 17:49       ` David Lechner
2025-09-05  9:44         ` Daniel Lezcano
2025-09-05 15:25           ` David Lechner
2025-09-05 20:58             ` Daniel Lezcano
2025-09-05 21:54               ` David Lechner
2025-09-08 12:16                 ` Daniel Lezcano
2025-09-08 13:58                   ` David Lechner
2025-09-09  9:29                     ` Nuno Sá
2025-09-09 16:22                       ` Daniel Lezcano
2025-09-10 11:57                         ` Nuno Sá
2025-09-10 16:21                           ` Jonathan Cameron
2025-09-03 11:48   ` Andy Shevchenko
2025-09-03 15:28     ` Daniel Lezcano
2025-09-04  7:33       ` Andy Shevchenko
2025-09-04 16:52         ` Daniel Lezcano
2025-09-09  9:04         ` Daniel Lezcano
2025-09-06  7:34   ` Krzysztof Kozlowski [this message]

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=6988c5d0-796a-4ab0-88d5-7051c80b5bba@kernel.org \
    --to=krzk@kernel.org \
    --cc=andy@kernel.org \
    --cc=chester62515@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=ghennadi.procopciuc@oss.nxp.com \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbrugger@suse.com \
    --cc=nuno.sa@analog.com \
    --cc=robh@kernel.org \
    --cc=s32@nxp.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

all inboxes | Powered by JetHome®