lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 12 Jun 2023 18:55:59 +0300
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Mehdi Djait <mehdi.djait.k@...il.com>
Cc:     jic23@...nel.org, mazziesaccount@...il.com,
        krzysztof.kozlowski+dt@...aro.org, robh+dt@...nel.org,
        lars@...afoo.de, linux-iio@...r.kernel.org,
        linux-kernel@...r.kernel.org, devicetree@...r.kernel.org
Subject: Re: [PATCH v5 6/7] iio: accel: kionix-kx022a: Add a function to
 retrieve number of bytes in buffer

On Mon, Jun 12, 2023 at 04:22:09PM +0200, Mehdi Djait wrote:
> Since Kionix accelerometers use various numbers of bits to report data, a
> device-specific function is required.
> Implement the function as a callback in the device-specific chip_info structure

...

> +static int kx022a_get_fifo_bytes(struct kx022a_data *data)
> +{
> +	int ret, fifo_bytes;
> +
> +	ret = regmap_read(data->regmap, KX022A_REG_BUF_STATUS_1, &fifo_bytes);
> +	if (ret) {
> +		dev_err(data->dev, "Error reading buffer status\n");
> +		return ret;
> +	}
> +
> +	if (fifo_bytes == KX022A_FIFO_FULL_VALUE)

> +		fifo_bytes = KX022A_FIFO_MAX_BYTES;

You can return this constant directly.

> +	return fifo_bytes;
> +}

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ