* [morimoto:sound-cleanup-2026-03-27 99/106] sound/soc/codecs/max98088.c:1433 max98088_setup_eq1() warn: inconsistent indenting
@ 2026-03-27 18:37 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-03-27 18:37 UTC (permalink / raw)
To: Kuninori Morimoto; +Cc: oe-kbuild-all
tree: https://github.com/morimoto/linux sound-cleanup-2026-03-27
head: b547ff73a13ed8ce92e8e208ccd27884077b160b
commit: 879b75696a5873f14bab3b278b787629fdb3f010 [99/106] don't use snd_soc_component_get_drvdata()
config: hexagon-randconfig-r073-20260327 (https://download.01.org/0day-ci/archive/20260328/202603280226.FbbINgDV-lkp@intel.com/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 054e11d1a17e5ba88bb1a8ef32fad3346e80b186)
smatch: v0.5.0-9004-gb810ac53
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603280226.FbbINgDV-lkp@intel.com/
New smatch warnings:
sound/soc/codecs/max98088.c:1433 max98088_setup_eq1() warn: inconsistent indenting
sound/soc/codecs/max98088.c:1481 max98088_setup_eq2() warn: inconsistent indenting
sound/soc/codecs/max98088.c:1580 max98088_handle_eq_pdata() warn: inconsistent indenting
sound/soc/codecs/max98088.c:1641 max98088_handle_pdata() warn: inconsistent indenting
sound/soc/codecs/max98088.c:1674 max98088_probe() warn: inconsistent indenting
sound/soc/codecs/max98088.c:1735 max98088_remove() warn: inconsistent indenting
Old smatch warnings:
sound/soc/codecs/max98088.c:657 max98088_line_pga() warn: inconsistent indenting
sound/soc/codecs/max98088.c:1026 max98088_dai2_hw_params() warn: inconsistent indenting
sound/soc/codecs/max98088.c:1096 max98088_dai_set_sysclk() warn: inconsistent indenting
sound/soc/codecs/max98088.c:1100 max98088_dai_set_sysclk() warn: inconsistent indenting
sound/soc/codecs/max98088.c:1112 max98088_dai_set_sysclk() warn: inconsistent indenting
sound/soc/codecs/max98088.c:1141 max98088_dai1_set_fmt() warn: inconsistent indenting
sound/soc/codecs/max98088.c:1212 max98088_dai2_set_fmt() warn: inconsistent indenting
sound/soc/codecs/max98088.c:1279 max98088_dai1_mute() warn: inconsistent indenting
sound/soc/codecs/max98088.c:1295 max98088_dai2_mute() warn: inconsistent indenting
sound/soc/codecs/max98088.c:1536 max98088_put_eq_enum() warn: inconsistent indenting
vim +1433 sound/soc/codecs/max98088.c
1429
1430 static void max98088_setup_eq1(struct snd_soc_component *component)
1431 {
1432 struct device *dev = snd_soc_component_to_dev(component);
> 1433 struct max98088_priv *max98088 = dev_get_drvdata(dev);
1434 struct max98088_pdata *pdata = max98088->pdata;
1435 struct max98088_eq_cfg *coef_set;
1436 int best, best_val, save, i, sel, fs;
1437 struct max98088_cdata *cdata;
1438
1439 cdata = &max98088->dai[0];
1440
1441 if (!pdata || !max98088->eq_textcnt)
1442 return;
1443
1444 /* Find the selected configuration with nearest sample rate */
1445 fs = cdata->rate;
1446 sel = cdata->eq_sel;
1447
1448 best = 0;
1449 best_val = INT_MAX;
1450 for (i = 0; i < pdata->eq_cfgcnt; i++) {
1451 if (strcmp(pdata->eq_cfg[i].name, max98088->eq_texts[sel]) == 0 &&
1452 abs(pdata->eq_cfg[i].rate - fs) < best_val) {
1453 best = i;
1454 best_val = abs(pdata->eq_cfg[i].rate - fs);
1455 }
1456 }
1457
1458 dev_dbg(dev, "Selected %s/%dHz for %dHz sample rate\n",
1459 pdata->eq_cfg[best].name,
1460 pdata->eq_cfg[best].rate, fs);
1461
1462 /* Disable EQ while configuring, and save current on/off state */
1463 save = snd_soc_component_read(component, M98088_REG_49_CFG_LEVEL);
1464 snd_soc_component_update_bits(component, M98088_REG_49_CFG_LEVEL, M98088_EQ1EN, 0);
1465
1466 coef_set = &pdata->eq_cfg[sel];
1467
1468 m98088_eq_band(component, 0, 0, coef_set->band1);
1469 m98088_eq_band(component, 0, 1, coef_set->band2);
1470 m98088_eq_band(component, 0, 2, coef_set->band3);
1471 m98088_eq_band(component, 0, 3, coef_set->band4);
1472 m98088_eq_band(component, 0, 4, coef_set->band5);
1473
1474 /* Restore the original on/off state */
1475 snd_soc_component_update_bits(component, M98088_REG_49_CFG_LEVEL, M98088_EQ1EN, save);
1476 }
1477
1478 static void max98088_setup_eq2(struct snd_soc_component *component)
1479 {
1480 struct device *dev = snd_soc_component_to_dev(component);
> 1481 struct max98088_priv *max98088 = dev_get_drvdata(dev);
1482 struct max98088_pdata *pdata = max98088->pdata;
1483 struct max98088_eq_cfg *coef_set;
1484 int best, best_val, save, i, sel, fs;
1485 struct max98088_cdata *cdata;
1486
1487 cdata = &max98088->dai[1];
1488
1489 if (!pdata || !max98088->eq_textcnt)
1490 return;
1491
1492 /* Find the selected configuration with nearest sample rate */
1493 fs = cdata->rate;
1494
1495 sel = cdata->eq_sel;
1496 best = 0;
1497 best_val = INT_MAX;
1498 for (i = 0; i < pdata->eq_cfgcnt; i++) {
1499 if (strcmp(pdata->eq_cfg[i].name, max98088->eq_texts[sel]) == 0 &&
1500 abs(pdata->eq_cfg[i].rate - fs) < best_val) {
1501 best = i;
1502 best_val = abs(pdata->eq_cfg[i].rate - fs);
1503 }
1504 }
1505
1506 dev_dbg(dev, "Selected %s/%dHz for %dHz sample rate\n",
1507 pdata->eq_cfg[best].name,
1508 pdata->eq_cfg[best].rate, fs);
1509
1510 /* Disable EQ while configuring, and save current on/off state */
1511 save = snd_soc_component_read(component, M98088_REG_49_CFG_LEVEL);
1512 snd_soc_component_update_bits(component, M98088_REG_49_CFG_LEVEL, M98088_EQ2EN, 0);
1513
1514 coef_set = &pdata->eq_cfg[sel];
1515
1516 m98088_eq_band(component, 1, 0, coef_set->band1);
1517 m98088_eq_band(component, 1, 1, coef_set->band2);
1518 m98088_eq_band(component, 1, 2, coef_set->band3);
1519 m98088_eq_band(component, 1, 3, coef_set->band4);
1520 m98088_eq_band(component, 1, 4, coef_set->band5);
1521
1522 /* Restore the original on/off state */
1523 snd_soc_component_update_bits(component, M98088_REG_49_CFG_LEVEL, M98088_EQ2EN,
1524 save);
1525 }
1526
1527 static int max98088_put_eq_enum(struct snd_kcontrol *kcontrol,
1528 struct snd_ctl_elem_value *ucontrol)
1529 {
1530 struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
1531 struct device *dev = snd_soc_component_to_dev(component);
1532 struct max98088_priv *max98088 = dev_get_drvdata(dev);
1533 struct max98088_pdata *pdata = max98088->pdata;
1534 int channel = max98088_get_channel(component, kcontrol->id.name);
1535 struct max98088_cdata *cdata;
1536 int sel = ucontrol->value.enumerated.item[0];
1537
1538 if (channel < 0)
1539 return channel;
1540
1541 cdata = &max98088->dai[channel];
1542
1543 if (sel >= pdata->eq_cfgcnt)
1544 return -EINVAL;
1545
1546 cdata->eq_sel = sel;
1547
1548 switch (channel) {
1549 case 0:
1550 max98088_setup_eq1(component);
1551 break;
1552 case 1:
1553 max98088_setup_eq2(component);
1554 break;
1555 }
1556
1557 return 0;
1558 }
1559
1560 static int max98088_get_eq_enum(struct snd_kcontrol *kcontrol,
1561 struct snd_ctl_elem_value *ucontrol)
1562 {
1563 struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
1564 struct device *dev = snd_soc_component_to_dev(component);
1565 struct max98088_priv *max98088 = dev_get_drvdata(dev);
1566 int channel = max98088_get_channel(component, kcontrol->id.name);
1567 struct max98088_cdata *cdata;
1568
1569 if (channel < 0)
1570 return channel;
1571
1572 cdata = &max98088->dai[channel];
1573 ucontrol->value.enumerated.item[0] = cdata->eq_sel;
1574 return 0;
1575 }
1576
1577 static void max98088_handle_eq_pdata(struct snd_soc_component *component)
1578 {
1579 struct device *dev = snd_soc_component_to_dev(component);
> 1580 struct max98088_priv *max98088 = dev_get_drvdata(dev);
1581 struct max98088_pdata *pdata = max98088->pdata;
1582 struct max98088_eq_cfg *cfg;
1583 unsigned int cfgcnt;
1584 int i, j;
1585 const char **t;
1586 int ret;
1587 struct snd_kcontrol_new controls[] = {
1588 SOC_ENUM_EXT((char *)eq_mode_name[0],
1589 max98088->eq_enum,
1590 max98088_get_eq_enum,
1591 max98088_put_eq_enum),
1592 SOC_ENUM_EXT((char *)eq_mode_name[1],
1593 max98088->eq_enum,
1594 max98088_get_eq_enum,
1595 max98088_put_eq_enum),
1596 };
1597 BUILD_BUG_ON(ARRAY_SIZE(controls) != ARRAY_SIZE(eq_mode_name));
1598
1599 cfg = pdata->eq_cfg;
1600 cfgcnt = pdata->eq_cfgcnt;
1601
1602 /* Setup an array of texts for the equalizer enum.
1603 * This is based on Mark Brown's equalizer driver code.
1604 */
1605 max98088->eq_textcnt = 0;
1606 max98088->eq_texts = NULL;
1607 for (i = 0; i < cfgcnt; i++) {
1608 for (j = 0; j < max98088->eq_textcnt; j++) {
1609 if (strcmp(cfg[i].name, max98088->eq_texts[j]) == 0)
1610 break;
1611 }
1612
1613 if (j != max98088->eq_textcnt)
1614 continue;
1615
1616 /* Expand the array */
1617 t = krealloc(max98088->eq_texts,
1618 sizeof(char *) * (max98088->eq_textcnt + 1),
1619 GFP_KERNEL);
1620 if (t == NULL)
1621 continue;
1622
1623 /* Store the new entry */
1624 t[max98088->eq_textcnt] = cfg[i].name;
1625 max98088->eq_textcnt++;
1626 max98088->eq_texts = t;
1627 }
1628
1629 /* Now point the soc_enum to .texts array items */
1630 max98088->eq_enum.texts = max98088->eq_texts;
1631 max98088->eq_enum.items = max98088->eq_textcnt;
1632
1633 ret = snd_soc_component_add_controls(component, controls, ARRAY_SIZE(controls));
1634 if (ret != 0)
1635 dev_err(component->dev, "Failed to add EQ control: %d\n", ret);
1636 }
1637
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-03-27 18:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-27 18:37 [morimoto:sound-cleanup-2026-03-27 99/106] sound/soc/codecs/max98088.c:1433 max98088_setup_eq1() warn: inconsistent indenting kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.