diff mbox series

Correct bit mask for ADC result according to ADC's resolution.

Message ID 20210204155430.GA557111@ubuntu (mailing list archive)
State New, archived
Headers show
Series Correct bit mask for ADC result according to ADC's resolution. | expand

Commit Message

Wilfried Wessner Feb. 4, 2021, 3:54 p.m. UTC
Signed-off-by: Wilfried Wessner <wilfried.wessner@gmail.com>
---
 drivers/iio/adc/ad7949.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Greg KH Feb. 4, 2021, 4:11 p.m. UTC | #1
On Thu, Feb 04, 2021 at 04:54:30PM +0100, Wilfried Wessner wrote:
> Signed-off-by: Wilfried Wessner <wilfried.wessner@gmail.com>

I know I can't take patches without any changelog text :(
Wilfried Wessner Feb. 4, 2021, 5:17 p.m. UTC | #2
On Thu, Feb 4, 2021 at 5:11 PM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Thu, Feb 04, 2021 at 04:54:30PM +0100, Wilfried Wessner wrote:
> > Signed-off-by: Wilfried Wessner <wilfried.wessner@gmail.com>
>
> I know I can't take patches without any changelog text :(
>
Sorry, it's my first submitted patch, but what exactly do you mean by
"changelog text"?

Soemthing like:
"This patch fixes a wrong result mask, which was caused by an improper
 usage of the GENMASK macro.
The GENMASK macro indexing is zero based, so if the ADC-result is
right aligned stored in an integer based type, the mask
goes from [resolution -1 , 0]."

Thank you for your help!

Best regards,
Willi
Greg KH Feb. 5, 2021, 9:06 a.m. UTC | #3
On Thu, Feb 04, 2021 at 06:17:46PM +0100, Wilfried Wessner wrote:
> On Thu, Feb 4, 2021 at 5:11 PM Greg KH <gregkh@linuxfoundation.org> wrote:
> >
> > On Thu, Feb 04, 2021 at 04:54:30PM +0100, Wilfried Wessner wrote:
> > > Signed-off-by: Wilfried Wessner <wilfried.wessner@gmail.com>
> >
> > I know I can't take patches without any changelog text :(
> >
> Sorry, it's my first submitted patch, but what exactly do you mean by
> "changelog text"?

As my patch bot will say:

- You did not specify a description of why the patch is needed, or
  possibly, any description at all, in the email body.  Please read the
  section entitled "The canonical patch format" in the kernel file,
  Documentation/SubmittingPatches for what is needed in order to
  properly describe the change.

- You did not write a descriptive Subject: for the patch, allowing Greg,
  and everyone else, to know what this patch is all about.  Please read
  the section entitled "The canonical patch format" in the kernel file,
  Documentation/SubmittingPatches for what a proper Subject: line should
  look like.

Read that file and then resend (with the proper version information) and
all should be good!

thanks,

greg k-h
diff mbox series

Patch

diff --git a/drivers/iio/adc/ad7949.c b/drivers/iio/adc/ad7949.c
index 5d597e5050f6..a5b4858cb6dc 100644
--- a/drivers/iio/adc/ad7949.c
+++ b/drivers/iio/adc/ad7949.c
@@ -91,7 +91,7 @@  static int ad7949_spi_read_channel(struct ad7949_adc_chip *ad7949_adc, int *val,
 	int ret;
 	int i;
 	int bits_per_word = ad7949_adc->resolution;
-	int mask = GENMASK(ad7949_adc->resolution, 0);
+	int mask = GENMASK((ad7949_adc->resolution-1), 0);
 	struct spi_message msg;
 	struct spi_transfer tx[] = {
 		{