* max1363 : Warnings from iio_sanity_check_avail_scan_masks() @ 2025-04-23 20:23 Fabio Estevam 2025-04-26 15:00 ` Jonathan Cameron 0 siblings, 1 reply; 12+ messages in thread From: Fabio Estevam @ 2025-04-23 20:23 UTC (permalink / raw) To: Jonathan Cameron; +Cc: mazziesaccount, linux-iio Hi, After upgrading the kernel from 6.1 to 6.12 (also tested with linux-next), I started seeing the following warnings on a board populated with a Maxim MAX11601 ADC: [ 1.554029] max1363 1-0064: available_scan_mask 8 subset of 0. Never used [ 1.563627] max1363 1-0064: available_scan_mask 9 subset of 0. Never used [ 1.570439] max1363 1-0064: available_scan_mask 10 subset of 0. Never used [ 1.577328] max1363 1-0064: available_scan_mask 11 subset of 0. Never used [ 1.584226] max1363 1-0064: available_scan_mask 12 subset of 0. Never used [ 1.591119] max1363 1-0064: available_scan_mask 13 subset of 0. Never used [ 1.598013] max1363 1-0064: available_scan_mask 8 subset of 1. Never used [ 1.604817] max1363 1-0064: available_scan_mask 9 subset of 1. Never used [ 1.611623] max1363 1-0064: available_scan_mask 10 subset of 1. Never used [ 1.618516] max1363 1-0064: available_scan_mask 11 subset of 1. Never used [ 1.625403] max1363 1-0064: available_scan_mask 12 subset of 1. Never used [ 1.632293] max1363 1-0064: available_scan_mask 13 subset of 1. Never used [ 1.639201] max1363 1-0064: available_scan_mask 8 subset of 2. Never used [ 1.646002] max1363 1-0064: available_scan_mask 9 subset of 2. Never used [ 1.652802] max1363 1-0064: available_scan_mask 10 subset of 2. Never used [ 1.659691] max1363 1-0064: available_scan_mask 11 subset of 2. Never used [ 1.666582] max1363 1-0064: available_scan_mask 12 subset of 2. Never used [ 1.673478] max1363 1-0064: available_scan_mask 13 subset of 2. Never used [ 1.680382] max1363 1-0064: available_scan_mask 8 subset of 3. Never used [ 1.687183] max1363 1-0064: available_scan_mask 9 subset of 3. Never used [ 1.693984] max1363 1-0064: available_scan_mask 10 subset of 3. Never used [ 1.700871] max1363 1-0064: available_scan_mask 11 subset of 3. Never used [ 1.707758] max1363 1-0064: available_scan_mask 12 subset of 3. Never used [ 1.714645] max1363 1-0064: available_scan_mask 13 subset of 3. Never used [ 1.721532] max1363 1-0064: available_scan_mask 8 subset of 4. Never used [ 1.728332] max1363 1-0064: available_scan_mask 9 subset of 4. Never used [ 1.735134] max1363 1-0064: available_scan_mask 10 subset of 4. Never used [ 1.742022] max1363 1-0064: available_scan_mask 11 subset of 4. Never used [ 1.748908] max1363 1-0064: available_scan_mask 12 subset of 4. Never used [ 1.755796] max1363 1-0064: available_scan_mask 13 subset of 4. Never used [ 1.762683] max1363 1-0064: available_scan_mask 8 subset of 5. Never used [ 1.769484] max1363 1-0064: available_scan_mask 9 subset of 5. Never used [ 1.776283] max1363 1-0064: available_scan_mask 10 subset of 5. Never used [ 1.783171] max1363 1-0064: available_scan_mask 11 subset of 5. Never used [ 1.790065] max1363 1-0064: available_scan_mask 12 subset of 5. Never used [ 1.796955] max1363 1-0064: available_scan_mask 13 subset of 5. Never used [ 1.803846] max1363 1-0064: available_scan_mask 7 subset of 6. Never used [ 1.810646] max1363 1-0064: available_scan_mask 8 subset of 6. Never used [ 1.817446] max1363 1-0064: available_scan_mask 9 subset of 6. Never used [ 1.824246] max1363 1-0064: available_scan_mask 10 subset of 6. Never used [ 1.831164] max1363 1-0064: available_scan_mask 11 subset of 6. Never used [ 1.838053] max1363 1-0064: available_scan_mask 12 subset of 6. Never used [ 1.844941] max1363 1-0064: available_scan_mask 13 subset of 6. Never used [ 1.851828] max1363 1-0064: available_scan_mask 8 subset of 7. Never used [ 1.858627] max1363 1-0064: available_scan_mask 9 subset of 7. Never used [ 1.865424] max1363 1-0064: available_scan_mask 10 subset of 7. Never used [ 1.872311] max1363 1-0064: available_scan_mask 11 subset of 7. Never used [ 1.879197] max1363 1-0064: available_scan_mask 12 subset of 7. Never used [ 1.886084] max1363 1-0064: available_scan_mask 13 subset of 7. Never used [ 1.892971] max1363 1-0064: available_scan_mask 9 subset of 8. Never used [ 1.899771] max1363 1-0064: available_scan_mask 10 subset of 8. Never used [ 1.906657] max1363 1-0064: available_scan_mask 11 subset of 8. Never used [ 1.913544] max1363 1-0064: available_scan_mask 12 subset of 8. Never used [ 1.920430] max1363 1-0064: available_scan_mask 13 subset of 8. Never used [ 1.927322] max1363 1-0064: available_scan_mask 10 subset of 9. Never used [ 1.934210] max1363 1-0064: available_scan_mask 11 subset of 9. Never used [ 1.941096] max1363 1-0064: available_scan_mask 12 subset of 9. Never used [ 1.947980] max1363 1-0064: available_scan_mask 13 subset of 9. Never used [ 1.954867] max1363 1-0064: available_scan_mask 11 subset of 10. Never used [ 1.961841] max1363 1-0064: available_scan_mask 12 subset of 10. Never used [ 1.968815] max1363 1-0064: available_scan_mask 13 subset of 10. Never used [ 1.975789] max1363 1-0064: available_scan_mask 12 subset of 11. Never used [ 1.982762] max1363 1-0064: available_scan_mask 13 subset of 11. Never used [ 1.989735] max1363 1-0064: available_scan_mask 13 subset of 12. Never used What is the correct way to fix these warnings? Thanks, Fabio Estevam ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: max1363 : Warnings from iio_sanity_check_avail_scan_masks() 2025-04-23 20:23 max1363 : Warnings from iio_sanity_check_avail_scan_masks() Fabio Estevam @ 2025-04-26 15:00 ` Jonathan Cameron 2025-04-26 21:00 ` Fabio Estevam 2025-04-28 5:38 ` Matti Vaittinen 0 siblings, 2 replies; 12+ messages in thread From: Jonathan Cameron @ 2025-04-26 15:00 UTC (permalink / raw) To: Fabio Estevam; +Cc: mazziesaccount, linux-iio On Wed, 23 Apr 2025 17:23:28 -0300 Fabio Estevam <festevam@gmail.com> wrote: > Hi, > > After upgrading the kernel from 6.1 to 6.12 (also tested with > linux-next), I started seeing the following warnings on a board > populated with a Maxim MAX11601 ADC: > > [ 1.554029] max1363 1-0064: available_scan_mask 8 subset of 0. Never used > [ 1.563627] max1363 1-0064: available_scan_mask 9 subset of 0. Never used > [ 1.570439] max1363 1-0064: available_scan_mask 10 subset of 0. Never used > [ 1.577328] max1363 1-0064: available_scan_mask 11 subset of 0. Never used > [ 1.584226] max1363 1-0064: available_scan_mask 12 subset of 0. Never used > [ 1.591119] max1363 1-0064: available_scan_mask 13 subset of 0. Never used > [ 1.598013] max1363 1-0064: available_scan_mask 8 subset of 1. Never used > [ 1.604817] max1363 1-0064: available_scan_mask 9 subset of 1. Never used > [ 1.611623] max1363 1-0064: available_scan_mask 10 subset of 1. Never used > [ 1.618516] max1363 1-0064: available_scan_mask 11 subset of 1. Never used > [ 1.625403] max1363 1-0064: available_scan_mask 12 subset of 1. Never used > [ 1.632293] max1363 1-0064: available_scan_mask 13 subset of 1. Never used > [ 1.639201] max1363 1-0064: available_scan_mask 8 subset of 2. Never used > [ 1.646002] max1363 1-0064: available_scan_mask 9 subset of 2. Never used > [ 1.652802] max1363 1-0064: available_scan_mask 10 subset of 2. Never used > [ 1.659691] max1363 1-0064: available_scan_mask 11 subset of 2. Never used > [ 1.666582] max1363 1-0064: available_scan_mask 12 subset of 2. Never used > [ 1.673478] max1363 1-0064: available_scan_mask 13 subset of 2. Never used > [ 1.680382] max1363 1-0064: available_scan_mask 8 subset of 3. Never used > [ 1.687183] max1363 1-0064: available_scan_mask 9 subset of 3. Never used > [ 1.693984] max1363 1-0064: available_scan_mask 10 subset of 3. Never used > [ 1.700871] max1363 1-0064: available_scan_mask 11 subset of 3. Never used > [ 1.707758] max1363 1-0064: available_scan_mask 12 subset of 3. Never used > [ 1.714645] max1363 1-0064: available_scan_mask 13 subset of 3. Never used > [ 1.721532] max1363 1-0064: available_scan_mask 8 subset of 4. Never used > [ 1.728332] max1363 1-0064: available_scan_mask 9 subset of 4. Never used > [ 1.735134] max1363 1-0064: available_scan_mask 10 subset of 4. Never used > [ 1.742022] max1363 1-0064: available_scan_mask 11 subset of 4. Never used > [ 1.748908] max1363 1-0064: available_scan_mask 12 subset of 4. Never used > [ 1.755796] max1363 1-0064: available_scan_mask 13 subset of 4. Never used > [ 1.762683] max1363 1-0064: available_scan_mask 8 subset of 5. Never used > [ 1.769484] max1363 1-0064: available_scan_mask 9 subset of 5. Never used > [ 1.776283] max1363 1-0064: available_scan_mask 10 subset of 5. Never used > [ 1.783171] max1363 1-0064: available_scan_mask 11 subset of 5. Never used > [ 1.790065] max1363 1-0064: available_scan_mask 12 subset of 5. Never used > [ 1.796955] max1363 1-0064: available_scan_mask 13 subset of 5. Never used > [ 1.803846] max1363 1-0064: available_scan_mask 7 subset of 6. Never used > [ 1.810646] max1363 1-0064: available_scan_mask 8 subset of 6. Never used > [ 1.817446] max1363 1-0064: available_scan_mask 9 subset of 6. Never used > [ 1.824246] max1363 1-0064: available_scan_mask 10 subset of 6. Never used > [ 1.831164] max1363 1-0064: available_scan_mask 11 subset of 6. Never used > [ 1.838053] max1363 1-0064: available_scan_mask 12 subset of 6. Never used > [ 1.844941] max1363 1-0064: available_scan_mask 13 subset of 6. Never used > [ 1.851828] max1363 1-0064: available_scan_mask 8 subset of 7. Never used > [ 1.858627] max1363 1-0064: available_scan_mask 9 subset of 7. Never used > [ 1.865424] max1363 1-0064: available_scan_mask 10 subset of 7. Never used > [ 1.872311] max1363 1-0064: available_scan_mask 11 subset of 7. Never used > [ 1.879197] max1363 1-0064: available_scan_mask 12 subset of 7. Never used > [ 1.886084] max1363 1-0064: available_scan_mask 13 subset of 7. Never used > [ 1.892971] max1363 1-0064: available_scan_mask 9 subset of 8. Never used > [ 1.899771] max1363 1-0064: available_scan_mask 10 subset of 8. Never used > [ 1.906657] max1363 1-0064: available_scan_mask 11 subset of 8. Never used > [ 1.913544] max1363 1-0064: available_scan_mask 12 subset of 8. Never used > [ 1.920430] max1363 1-0064: available_scan_mask 13 subset of 8. Never used > [ 1.927322] max1363 1-0064: available_scan_mask 10 subset of 9. Never used > [ 1.934210] max1363 1-0064: available_scan_mask 11 subset of 9. Never used > [ 1.941096] max1363 1-0064: available_scan_mask 12 subset of 9. Never used > [ 1.947980] max1363 1-0064: available_scan_mask 13 subset of 9. Never used > [ 1.954867] max1363 1-0064: available_scan_mask 11 subset of 10. Never used > [ 1.961841] max1363 1-0064: available_scan_mask 12 subset of 10. Never used > [ 1.968815] max1363 1-0064: available_scan_mask 13 subset of 10. Never used > [ 1.975789] max1363 1-0064: available_scan_mask 12 subset of 11. Never used > [ 1.982762] max1363 1-0064: available_scan_mask 13 subset of 11. Never used > [ 1.989735] max1363 1-0064: available_scan_mask 13 subset of 12. Never used > > What is the correct way to fix these warnings? Ah. I think we have an order of modes bug.. Later entries should never be a subset of earlier ones and we only recently added a sanity check on that. static const enum max1363_modes max11607_mode_list[] = { _s0, _s1, _s2, _s3, s0to1, s0to2, s0to3, s2to3, d0m1, d2m3, d1m0, d3m2, d0m1to2m3, d1m0to3m2, }; Is used to build available_scan_masks for this device. I'm failing to correlate with the warnings but clearly s2to3 is a subset of s0to3 channels 2,3 vs 0,1,2,3 In general we should do a few things in here. Reorder the enum max1363 to reflect the subset rule correctly (may be fine from a quick look). Use that to set the entries in the max1363_mode_table. (I think it's fine today but we can enforce that). Finally ensure we obey the rules for the individual mode_list tables. With that stuff fixed we should remove possibility of enabling more channels than strictly necessary (which is what that print is moaning about.) As a trivial test, just reorder max11607_mode_list[] it might fix your warning. I'm a bit unconvinced that this is the only issue though as we should have only seen 7 is a subset of 6. If you can dump the available_modes table that is generated that might let us see what is causing there to be so many warnings. Jonathan > > Thanks, > > Fabio Estevam ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: max1363 : Warnings from iio_sanity_check_avail_scan_masks() 2025-04-26 15:00 ` Jonathan Cameron @ 2025-04-26 21:00 ` Fabio Estevam 2025-04-27 10:23 ` Jonathan Cameron 2025-04-28 5:38 ` Matti Vaittinen 1 sibling, 1 reply; 12+ messages in thread From: Fabio Estevam @ 2025-04-26 21:00 UTC (permalink / raw) To: Jonathan Cameron; +Cc: mazziesaccount, linux-iio Hi Jonathan, On Sat, Apr 26, 2025 at 12:00 PM Jonathan Cameron <jic23@kernel.org> wrote: > As a trivial test, just reorder max11607_mode_list[] it might fix your warning. I appreciate your suggestion. If I rearrange it like this (only added single channel entries), I don't see any warnings: static const enum max1363_modes max11607_mode_list[] = { _s0, _s1, _s2, _s3, s0to1, s2to3, s0to2, s0to3, }; However, whenever the differential channels' definitions are inserted, the warnings reappear. > If you can dump the available_modes table that is generated that might let > us see what is causing there to be so many warnings. What is an appropriate place to dump the available_modes table? I am happy to test any debug patches if you could share them. Thanks, Fabio Estevam ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: max1363 : Warnings from iio_sanity_check_avail_scan_masks() 2025-04-26 21:00 ` Fabio Estevam @ 2025-04-27 10:23 ` Jonathan Cameron 2025-04-28 19:03 ` Fabio Estevam 0 siblings, 1 reply; 12+ messages in thread From: Jonathan Cameron @ 2025-04-27 10:23 UTC (permalink / raw) To: Fabio Estevam; +Cc: mazziesaccount, linux-iio On Sat, 26 Apr 2025 18:00:07 -0300 Fabio Estevam <festevam@gmail.com> wrote: > Hi Jonathan, > > On Sat, Apr 26, 2025 at 12:00 PM Jonathan Cameron <jic23@kernel.org> wrote: > > > As a trivial test, just reorder max11607_mode_list[] it might fix your warning. > > I appreciate your suggestion. > > If I rearrange it like this (only added single channel entries), I > don't see any warnings: > > static const enum max1363_modes max11607_mode_list[] = { > _s0, _s1, _s2, _s3, > s0to1, s2to3, > s0to2, > s0to3, > }; > > However, whenever the differential channels' definitions are inserted, > the warnings reappear. > > > If you can dump the available_modes table that is generated that might let > > us see what is causing there to be so many warnings. > > What is an appropriate place to dump the available_modes table? https://elixir.bootlin.com/linux/v6.14.4/source/drivers/iio/adc/max1363.c#L1460 There is where they are set. Should show us if something weird is going on with what the checks are seeing vs something going wrong at the debug check. J > > I am happy to test any debug patches if you could share them. > > Thanks, > > Fabio Estevam ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: max1363 : Warnings from iio_sanity_check_avail_scan_masks() 2025-04-27 10:23 ` Jonathan Cameron @ 2025-04-28 19:03 ` Fabio Estevam 2025-04-28 21:16 ` Fabio Estevam 0 siblings, 1 reply; 12+ messages in thread From: Fabio Estevam @ 2025-04-28 19:03 UTC (permalink / raw) To: Jonathan Cameron; +Cc: mazziesaccount, linux-iio Hi Jonathan, On Sun, Apr 27, 2025 at 7:23 AM Jonathan Cameron <jic23@kernel.org> wrote: > https://elixir.bootlin.com/linux/v6.14.4/source/drivers/iio/adc/max1363.c#L1460 > There is where they are set. Should show us if something weird is going on with > what the checks are seeing vs something going wrong at the debug check. I am not sure if this is what you want me to print: --- a/drivers/iio/adc/max1363.c +++ b/drivers/iio/adc/max1363.c @@ -1453,6 +1453,8 @@ static int max1363_alloc_scan_masks(struct iio_dev *indio_dev) indio_dev->available_scan_masks = masks; + pr_err("************ available_scan_masks is %lu\n", *masks); + return 0; } [ 1.559919] ************ available_scan_masks is 1 [ 1.565265] max1363 1-0064: available_scan_mask 8 subset of 0. Never used [ 1.572104] max1363 1-0064: available_scan_mask 9 subset of 0. Never used [ 1.578912] max1363 1-0064: available_scan_mask 10 subset of 0. Never used [ 1.585805] max1363 1-0064: available_scan_mask 11 subset of 0. Never used [ 1.592699] max1363 1-0064: available_scan_mask 12 subset of 0. Never used [ 1.599586] max1363 1-0064: available_scan_mask 13 subset of 0. Never used [ 1.606488] max1363 1-0064: available_scan_mask 8 subset of 1. Never used [ 1.613287] max1363 1-0064: available_scan_mask 9 subset of 1. Never used [ 1.620092] max1363 1-0064: available_scan_mask 10 subset of 1. Never used [ 1.626989] max1363 1-0064: available_scan_mask 11 subset of 1. Never used [ 1.633882] max1363 1-0064: available_scan_mask 12 subset of 1. Never used [ 1.640772] max1363 1-0064: available_scan_mask 13 subset of 1. Never used [ 1.647664] max1363 1-0064: available_scan_mask 8 subset of 2. Never used [ 1.654473] max1363 1-0064: available_scan_mask 9 subset of 2. Never used [ 1.661274] max1363 1-0064: available_scan_mask 10 subset of 2. Never used [ 1.668171] max1363 1-0064: available_scan_mask 11 subset of 2. Never used [ 1.675063] max1363 1-0064: available_scan_mask 12 subset of 2. Never used [ 1.681957] max1363 1-0064: available_scan_mask 13 subset of 2. Never used [ 1.688851] max1363 1-0064: available_scan_mask 8 subset of 3. Never used [ 1.695665] max1363 1-0064: available_scan_mask 9 subset of 3. Never used [ 1.702466] max1363 1-0064: available_scan_mask 10 subset of 3. Never used [ 1.709364] max1363 1-0064: available_scan_mask 11 subset of 3. Never used [ 1.716248] max1363 1-0064: available_scan_mask 12 subset of 3. Never used [ 1.723134] max1363 1-0064: available_scan_mask 13 subset of 3. Never used [ 1.730020] max1363 1-0064: available_scan_mask 8 subset of 4. Never used [ 1.736821] max1363 1-0064: available_scan_mask 9 subset of 4. Never used [ 1.743622] max1363 1-0064: available_scan_mask 10 subset of 4. Never used [ 1.750508] max1363 1-0064: available_scan_mask 11 subset of 4. Never used [ 1.757396] max1363 1-0064: available_scan_mask 12 subset of 4. Never used [ 1.764283] max1363 1-0064: available_scan_mask 13 subset of 4. Never used [ 1.771170] max1363 1-0064: available_scan_mask 8 subset of 5. Never used [ 1.777975] max1363 1-0064: available_scan_mask 9 subset of 5. Never used [ 1.784775] max1363 1-0064: available_scan_mask 10 subset of 5. Never used [ 1.791662] max1363 1-0064: available_scan_mask 11 subset of 5. Never used [ 1.798547] max1363 1-0064: available_scan_mask 12 subset of 5. Never used [ 1.805434] max1363 1-0064: available_scan_mask 13 subset of 5. Never used [ 1.812323] max1363 1-0064: available_scan_mask 7 subset of 6. Never used [ 1.819122] max1363 1-0064: available_scan_mask 8 subset of 6. Never used [ 1.825949] max1363 1-0064: available_scan_mask 9 subset of 6. Never used [ 1.832750] max1363 1-0064: available_scan_mask 10 subset of 6. Never used [ 1.839656] max1363 1-0064: available_scan_mask 11 subset of 6. Never used [ 1.846545] max1363 1-0064: available_scan_mask 12 subset of 6. Never used [ 1.853430] max1363 1-0064: available_scan_mask 13 subset of 6. Never used [ 1.860317] max1363 1-0064: available_scan_mask 8 subset of 7. Never used [ 1.867116] max1363 1-0064: available_scan_mask 9 subset of 7. Never used [ 1.873915] max1363 1-0064: available_scan_mask 10 subset of 7. Never used [ 1.880801] max1363 1-0064: available_scan_mask 11 subset of 7. Never used [ 1.887686] max1363 1-0064: available_scan_mask 12 subset of 7. Never used [ 1.894573] max1363 1-0064: available_scan_mask 13 subset of 7. Never used [ 1.901466] max1363 1-0064: available_scan_mask 9 subset of 8. Never used [ 1.908267] max1363 1-0064: available_scan_mask 10 subset of 8. Never used [ 1.915153] max1363 1-0064: available_scan_mask 11 subset of 8. Never used [ 1.922037] max1363 1-0064: available_scan_mask 12 subset of 8. Never used [ 1.928923] max1363 1-0064: available_scan_mask 13 subset of 8. Never used [ 1.935810] max1363 1-0064: available_scan_mask 10 subset of 9. Never used [ 1.942696] max1363 1-0064: available_scan_mask 11 subset of 9. Never used [ 1.949582] max1363 1-0064: available_scan_mask 12 subset of 9. Never used [ 1.956469] max1363 1-0064: available_scan_mask 13 subset of 9. Never used [ 1.963356] max1363 1-0064: available_scan_mask 11 subset of 10. Never used [ 1.970330] max1363 1-0064: available_scan_mask 12 subset of 10. Never used [ 1.977303] max1363 1-0064: available_scan_mask 13 subset of 10. Never used [ 1.984276] max1363 1-0064: available_scan_mask 12 subset of 11. Never used [ 1.991249] max1363 1-0064: available_scan_mask 13 subset of 11. Never used [ 1.998222] max1363 1-0064: available_scan_mask 13 subset of 12. Never used ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: max1363 : Warnings from iio_sanity_check_avail_scan_masks() 2025-04-28 19:03 ` Fabio Estevam @ 2025-04-28 21:16 ` Fabio Estevam 2025-04-29 3:59 ` Matti Vaittinen 0 siblings, 1 reply; 12+ messages in thread From: Fabio Estevam @ 2025-04-28 21:16 UTC (permalink / raw) To: Jonathan Cameron; +Cc: mazziesaccount, linux-iio On Mon, Apr 28, 2025 at 4:03 PM Fabio Estevam <festevam@gmail.com> wrote: > > Hi Jonathan, > > On Sun, Apr 27, 2025 at 7:23 AM Jonathan Cameron <jic23@kernel.org> wrote: > > > https://elixir.bootlin.com/linux/v6.14.4/source/drivers/iio/adc/max1363.c#L1460 > > There is where they are set. Should show us if something weird is going on with > > what the checks are seeing vs something going wrong at the debug check. > > I am not sure if this is what you want me to print: Sorry, I should do it like this instead: --- a/drivers/iio/adc/max1363.c +++ b/drivers/iio/adc/max1363.c @@ -1453,6 +1453,9 @@ static int max1363_alloc_scan_masks(struct iio_dev *indio_dev) indio_dev->available_scan_masks = masks; + for (i = 0; i < st->chip_info->num_modes; i++) + pr_err("************ available_scan_masks is %lu\n", masks[i]); + return 0; } which prints: [ 1.567841] ************ available_scan_masks is 1 [ 1.577203] ************ available_scan_masks is 2 [ 1.582032] ************ available_scan_masks is 4 [ 1.586837] ************ available_scan_masks is 8 [ 1.591644] ************ available_scan_masks is 3 [ 1.596452] ************ available_scan_masks is 7 [ 1.601258] ************ available_scan_masks is 15 [ 1.606149] ************ available_scan_masks is 12 [ 1.611041] ************ available_scan_masks is 4096 [ 1.616101] ************ available_scan_masks is 8192 [ 1.616105] ************ available_scan_masks is 262144 [ 1.616108] ************ available_scan_masks is 524288 [ 1.640493] ************ available_scan_masks is 12288 [ 1.645640] ************ available_scan_masks is 786432 [ 1.652223] max1363 1-0064: available_scan_mask 8 subset of 0. Never used [ 1.659028] max1363 1-0064: available_scan_mask 9 subset of 0. Never used [ 1.665829] max1363 1-0064: available_scan_mask 10 subset of 0. Never used [ 1.672722] max1363 1-0064: available_scan_mask 11 subset of 0. Never used [ 1.677071] fec 30be0000.ethernet eth0: registered PHC device 0 [ 1.679623] max1363 1-0064: available_scan_mask 12 subset of 0. Never used [ 1.679630] max1363 1-0064: available_scan_mask 13 subset of 0. Never used [ 1.699327] max1363 1-0064: available_scan_mask 8 subset of 1. Never used [ 1.706131] max1363 1-0064: available_scan_mask 9 subset of 1. Never used [ 1.712932] max1363 1-0064: available_scan_mask 10 subset of 1. Never used [ 1.719819] max1363 1-0064: available_scan_mask 11 subset of 1. Never used [ 1.726706] max1363 1-0064: available_scan_mask 12 subset of 1. Never used [ 1.733593] max1363 1-0064: available_scan_mask 13 subset of 1. Never used [ 1.740490] max1363 1-0064: available_scan_mask 8 subset of 2. Never used [ 1.747296] max1363 1-0064: available_scan_mask 9 subset of 2. Never used [ 1.754106] max1363 1-0064: available_scan_mask 10 subset of 2. Never used [ 1.760995] max1363 1-0064: available_scan_mask 11 subset of 2. Never used [ 1.767882] max1363 1-0064: available_scan_mask 12 subset of 2. Never used [ 1.774769] max1363 1-0064: available_scan_mask 13 subset of 2. Never used [ 1.781660] max1363 1-0064: available_scan_mask 8 subset of 3. Never used [ 1.788470] max1363 1-0064: available_scan_mask 9 subset of 3. Never used [ 1.795280] max1363 1-0064: available_scan_mask 10 subset of 3. Never used [ 1.802170] max1363 1-0064: available_scan_mask 11 subset of 3. Never used [ 1.809058] max1363 1-0064: available_scan_mask 12 subset of 3. Never used [ 1.815947] max1363 1-0064: available_scan_mask 13 subset of 3. Never used [ 1.822836] max1363 1-0064: available_scan_mask 8 subset of 4. Never used [ 1.829658] max1363 1-0064: available_scan_mask 9 subset of 4. Never used [ 1.836465] max1363 1-0064: available_scan_mask 10 subset of 4. Never used [ 1.843356] max1363 1-0064: available_scan_mask 11 subset of 4. Never used [ 1.850273] max1363 1-0064: available_scan_mask 12 subset of 4. Never used [ 1.857191] max1363 1-0064: available_scan_mask 13 subset of 4. Never used [ 1.864101] max1363 1-0064: available_scan_mask 8 subset of 5. Never used [ 1.870913] max1363 1-0064: available_scan_mask 9 subset of 5. Never used [ 1.874462] mv88e6085 30be0000.ethernet-1:00: switch 0x1150 detected: Marvell 88E6320, revision 2 [ 1.877716] max1363 1-0064: available_scan_mask 10 subset of 5. Never used [ 1.893466] max1363 1-0064: available_scan_mask 11 subset of 5. Never used [ 1.900355] max1363 1-0064: available_scan_mask 12 subset of 5. Never used [ 1.907250] max1363 1-0064: available_scan_mask 13 subset of 5. Never used [ 1.914139] max1363 1-0064: available_scan_mask 7 subset of 6. Never used [ 1.920938] max1363 1-0064: available_scan_mask 8 subset of 6. Never used [ 1.927747] max1363 1-0064: available_scan_mask 9 subset of 6. Never used [ 1.934560] max1363 1-0064: available_scan_mask 10 subset of 6. Never used [ 1.941453] max1363 1-0064: available_scan_mask 11 subset of 6. Never used [ 1.948340] max1363 1-0064: available_scan_mask 12 subset of 6. Never used [ 1.955225] max1363 1-0064: available_scan_mask 13 subset of 6. Never used [ 1.962111] max1363 1-0064: available_scan_mask 8 subset of 7. Never used [ 1.968912] max1363 1-0064: available_scan_mask 9 subset of 7. Never used [ 1.975718] max1363 1-0064: available_scan_mask 10 subset of 7. Never used [ 1.982613] max1363 1-0064: available_scan_mask 11 subset of 7. Never used [ 1.989502] max1363 1-0064: available_scan_mask 12 subset of 7. Never used [ 1.996389] max1363 1-0064: available_scan_mask 13 subset of 7. Never used [ 2.003282] max1363 1-0064: available_scan_mask 9 subset of 8. Never used [ 2.010084] max1363 1-0064: available_scan_mask 10 subset of 8. Never used [ 2.016970] max1363 1-0064: available_scan_mask 11 subset of 8. Never used [ 2.023855] max1363 1-0064: available_scan_mask 12 subset of 8. Never used [ 2.030742] max1363 1-0064: available_scan_mask 13 subset of 8. Never used [ 2.037626] max1363 1-0064: available_scan_mask 10 subset of 9. Never used [ 2.044514] max1363 1-0064: available_scan_mask 11 subset of 9. Never used [ 2.051400] max1363 1-0064: available_scan_mask 12 subset of 9. Never used [ 2.058287] max1363 1-0064: available_scan_mask 13 subset of 9. Never used [ 2.065175] max1363 1-0064: available_scan_mask 11 subset of 10. Never used [ 2.072149] max1363 1-0064: available_scan_mask 12 subset of 10. Never used [ 2.079122] max1363 1-0064: available_scan_mask 13 subset of 10. Never used [ 2.086101] max1363 1-0064: available_scan_mask 12 subset of 11. Never used [ 2.093077] max1363 1-0064: available_scan_mask 13 subset of 11. Never used [ 2.100055] max1363 1-0064: available_scan_mask 13 subset of 12. Never used ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: max1363 : Warnings from iio_sanity_check_avail_scan_masks() 2025-04-28 21:16 ` Fabio Estevam @ 2025-04-29 3:59 ` Matti Vaittinen 2025-04-29 10:42 ` Fabio Estevam 2025-04-29 14:29 ` Fabio Estevam 0 siblings, 2 replies; 12+ messages in thread From: Matti Vaittinen @ 2025-04-29 3:59 UTC (permalink / raw) To: Fabio Estevam, Jonathan Cameron; +Cc: linux-iio On 29/04/2025 00:16, Fabio Estevam wrote: > On Mon, Apr 28, 2025 at 4:03 PM Fabio Estevam <festevam@gmail.com> wrote: >> >> Hi Jonathan, >> >> On Sun, Apr 27, 2025 at 7:23 AM Jonathan Cameron <jic23@kernel.org> wrote: >> >>> https://elixir.bootlin.com/linux/v6.14.4/source/drivers/iio/adc/max1363.c#L1460 >>> There is where they are set. Should show us if something weird is going on with >>> what the checks are seeing vs something going wrong at the debug check. >> >> I am not sure if this is what you want me to print: > > Sorry, I should do it like this instead: > > --- a/drivers/iio/adc/max1363.c > +++ b/drivers/iio/adc/max1363.c > @@ -1453,6 +1453,9 @@ static int max1363_alloc_scan_masks(struct > iio_dev *indio_dev) > > indio_dev->available_scan_masks = masks; > > + for (i = 0; i < st->chip_info->num_modes; i++) > + pr_err("************ available_scan_masks is %lu\n", masks[i]); > + > return 0; > } > > which prints: > > [ 1.567841] ************ available_scan_masks is 1 > [ 1.577203] ************ available_scan_masks is 2 > [ 1.582032] ************ available_scan_masks is 4 > [ 1.586837] ************ available_scan_masks is 8 > [ 1.591644] ************ available_scan_masks is 3 > [ 1.596452] ************ available_scan_masks is 7 > [ 1.601258] ************ available_scan_masks is 15 > [ 1.606149] ************ available_scan_masks is 12 Here, 12 is subset of 15. > [ 1.611041] ************ available_scan_masks is 4096 > [ 1.616101] ************ available_scan_masks is 8192 > [ 1.616105] ************ available_scan_masks is 262144 > [ 1.616108] ************ available_scan_masks is 524288 > [ 1.640493] ************ available_scan_masks is 12288 > [ 1.645640] ************ available_scan_masks is 786432 > [ 1.652223] max1363 1-0064: available_scan_mask 8 subset of 0. Never used > [ 1.659028] max1363 1-0064: available_scan_mask 9 subset of 0. Never used > [ 1.665829] max1363 1-0064: available_scan_mask 10 subset of 0. Never used > [ 1.672722] max1363 1-0064: available_scan_mask 11 subset of 0. Never used // snip So, majority of these prints seem to be garbage. AFAICS, we should only see: > [ 1.652223] max1363 1-0064: available_scan_mask 8 subset of 7. Never used Or maybe: available_scan_mask: mask[8] subset of mask[7]. Never used Do you think you could send a patch to fix this, or should I take a look at it? Yours, -- Matti ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: max1363 : Warnings from iio_sanity_check_avail_scan_masks() 2025-04-29 3:59 ` Matti Vaittinen @ 2025-04-29 10:42 ` Fabio Estevam 2025-04-29 14:29 ` Fabio Estevam 1 sibling, 0 replies; 12+ messages in thread From: Fabio Estevam @ 2025-04-29 10:42 UTC (permalink / raw) To: Matti Vaittinen; +Cc: Jonathan Cameron, linux-iio Hi Matti, On Tue, Apr 29, 2025 at 12:59 AM Matti Vaittinen <mazziesaccount@gmail.com> wrote: > So, majority of these prints seem to be garbage. AFAICS, we should only see: > > [ 1.652223] max1363 1-0064: available_scan_mask 8 subset of 7. > Never used > > Or maybe: > available_scan_mask: mask[8] subset of mask[7]. Never used > > Do you think you could send a patch to fix this, or should I take a look > at it? Please take a look at it if you have a chance. I will be glad to test a patch. Thanks! ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: max1363 : Warnings from iio_sanity_check_avail_scan_masks() 2025-04-29 3:59 ` Matti Vaittinen 2025-04-29 10:42 ` Fabio Estevam @ 2025-04-29 14:29 ` Fabio Estevam 1 sibling, 0 replies; 12+ messages in thread From: Fabio Estevam @ 2025-04-29 14:29 UTC (permalink / raw) To: Matti Vaittinen; +Cc: Jonathan Cameron, linux-iio Hi Matti, On Tue, Apr 29, 2025 at 12:59 AM Matti Vaittinen <mazziesaccount@gmail.com> wrote: > Do you think you could send a patch to fix this, or should I take a look > at it? Yes, I think I understand the problem better now and will send the patches. Thanks for your help. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: max1363 : Warnings from iio_sanity_check_avail_scan_masks() 2025-04-26 15:00 ` Jonathan Cameron 2025-04-26 21:00 ` Fabio Estevam @ 2025-04-28 5:38 ` Matti Vaittinen 2025-04-28 19:04 ` Fabio Estevam 1 sibling, 1 reply; 12+ messages in thread From: Matti Vaittinen @ 2025-04-28 5:38 UTC (permalink / raw) To: Jonathan Cameron, Fabio Estevam; +Cc: linux-iio Hi deee Ho peeps! On 26/04/2025 18:00, Jonathan Cameron wrote: > On Wed, 23 Apr 2025 17:23:28 -0300 > Fabio Estevam <festevam@gmail.com> wrote: >> After upgrading the kernel from 6.1 to 6.12 (also tested with >> linux-next), I started seeing the following warnings on a board >> populated with a Maxim MAX11601 ADC: >> >> [ 1.554029] max1363 1-0064: available_scan_mask 8 subset of 0. Never used >> [ 1.563627] max1363 1-0064: available_scan_mask 9 subset of 0. Never used >> >> What is the correct way to fix these warnings? > > Ah. I think we have an order of modes bug.. Later entries should never be a subset > of earlier ones and we only recently added a sanity check on that. This indeed rings a bell :) I have nothing really to add to the answers by Jonathan, but I just noticed the warning print isn't as clear as it could. As far as I understand, the printed values aren't the actual masks, but indexes in the mask arrays. Now that I had this stuff forgotten, I was puzzled by the print until I read the code. I believe it'd be more informative if we printed the actual bit masks - but I am not sure if we know the size of the mask. If we keep printing the indexes, then we might want to add brackets [] to indicate the value is an index? How about: "available_scan_masks: mask[8] subset of mask[0]. Never used" instead of: available_scan_mask 8 subset of 0. Never used Would that be more obvious? Yours, -- Matti ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: max1363 : Warnings from iio_sanity_check_avail_scan_masks() 2025-04-28 5:38 ` Matti Vaittinen @ 2025-04-28 19:04 ` Fabio Estevam 2025-04-29 3:50 ` Matti Vaittinen 0 siblings, 1 reply; 12+ messages in thread From: Fabio Estevam @ 2025-04-28 19:04 UTC (permalink / raw) To: Matti Vaittinen; +Cc: Jonathan Cameron, linux-iio Hi Matti, On Mon, Apr 28, 2025 at 2:38 AM Matti Vaittinen <mazziesaccount@gmail.com> wrote: > I believe it'd be more informative if we printed the actual bit masks - > but I am not sure if we know the size of the mask. If we keep printing > the indexes, then we might want to add brackets [] to indicate the value > is an index? How about: > > "available_scan_masks: mask[8] subset of mask[0]. Never used" > > instead of: > available_scan_mask 8 subset of 0. Never used > > Would that be more obvious? I still find the "Never used" part a bit cryptic. What exactly is never used? ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: max1363 : Warnings from iio_sanity_check_avail_scan_masks() 2025-04-28 19:04 ` Fabio Estevam @ 2025-04-29 3:50 ` Matti Vaittinen 0 siblings, 0 replies; 12+ messages in thread From: Matti Vaittinen @ 2025-04-29 3:50 UTC (permalink / raw) To: Fabio Estevam; +Cc: Jonathan Cameron, linux-iio On 28/04/2025 22:04, Fabio Estevam wrote: > Hi Matti, > > On Mon, Apr 28, 2025 at 2:38 AM Matti Vaittinen > <mazziesaccount@gmail.com> wrote: > >> I believe it'd be more informative if we printed the actual bit masks - >> but I am not sure if we know the size of the mask. If we keep printing >> the indexes, then we might want to add brackets [] to indicate the value >> is an index? How about: >> >> "available_scan_masks: mask[8] subset of mask[0]. Never used" >> >> instead of: >> available_scan_mask 8 subset of 0. Never used >> >> Would that be more obvious? > > I still find the "Never used" part a bit cryptic. What exactly is never used? When user wants to enable some channels, the IIO core scans the available_scan_masks -array in order to find a supported configuration which meets the requirements. IIO core does this scanning in the order, and stops when first suitable mask is found from the available_scan_masks. This means that if we have a mask which is a subset of a mask which is earlier in the array, this latter mask will never be used because the earlier one (the superset) will always be found first and picked by the IIO core. Eg, if mask[0] consists of bits 0,3,5,7 and mask[1] consists of bits 0,5 - then if user wants to enable channels 0 or 5 (or 0 and 5) - the mask[0] will always be picked by the IIO core because it fulfills the needs. This means IIO will always enable channels 0,3,5 and 7 - and never use the smaller configuration of only channels 0 and 5. Hence, the ordering of the masks matters, and this check (and print) was added. I hope this clarifies. Yours, -- Matti ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2025-04-29 14:30 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-04-23 20:23 max1363 : Warnings from iio_sanity_check_avail_scan_masks() Fabio Estevam 2025-04-26 15:00 ` Jonathan Cameron 2025-04-26 21:00 ` Fabio Estevam 2025-04-27 10:23 ` Jonathan Cameron 2025-04-28 19:03 ` Fabio Estevam 2025-04-28 21:16 ` Fabio Estevam 2025-04-29 3:59 ` Matti Vaittinen 2025-04-29 10:42 ` Fabio Estevam 2025-04-29 14:29 ` Fabio Estevam 2025-04-28 5:38 ` Matti Vaittinen 2025-04-28 19:04 ` Fabio Estevam 2025-04-29 3:50 ` Matti Vaittinen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox