Skip to contentSkip to conversation

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

PATCH In review Wilfried Wessner 2 participants 4 messages Feb 4, 2021 – Feb 5, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

---
 drivers/iio/adc/ad7949.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/ad7949.c +1 -1
index 5d597e5050f6..a5b4858cb6dc 100644
@@ -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[] = {
 		{
Signature · 1 line
2.25.1
#2 lore raw
Quoted 6 lines · Greg KH
Quoted 1 line · Wilfried Wessner

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

#3 lore raw
Quoted 9 lines · Wilfried Wessner
Quoted 6 lines · Greg KH
Quoted 1 line · Wilfried Wessner

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