Re: [PATCH v7 9/9] leds: Update the lp55xx to use the multi color framework

From: kbuild test robot
Date: Sat Sep 21 2019 - 11:40:11 EST


Hi Dan,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[cannot apply to v5.3 next-20190919]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Dan-Murphy/Multicolor-Framework-updates/20190920-023813
config: i386-randconfig-b003-201937 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-13) 7.4.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
:::::: branch date: 4 hours ago
:::::: commit date: 4 hours ago

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

ld: drivers/leds/leds-lp55xx-common.o: in function `lp55xx_set_brightness':
>> drivers/leds/leds-lp55xx-common.c:144: undefined reference to `led_mc_calc_brightness'
ld: drivers/leds/leds-lp55xx-common.o: in function `lp55xx_init_led':
>> drivers/leds/leds-lp55xx-common.c:216: undefined reference to `led_classdev_multicolor_register_ext'

# https://github.com/0day-ci/linux/commit/d907bc23f70b4ca46747f42ec24a2066fa4602b0
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout d907bc23f70b4ca46747f42ec24a2066fa4602b0
vim +144 drivers/leds/leds-lp55xx-common.c

0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 133)
95b2af637e283e Andrew Lunn 2015-08-20 134 static int lp55xx_set_brightness(struct led_classdev *cdev,
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 135) enum led_brightness brightness)
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 136) {
a6e4679a09a0a2 Milo(Woogyom Kim 2013-02-05 137) struct lp55xx_led *led = cdev_to_lp55xx_led(cdev);
95b2af637e283e Andrew Lunn 2015-08-20 138 struct lp55xx_device_config *cfg = led->chip->cfg;
d907bc23f70b4c Dan Murphy 2019-09-19 139 int adj_value[LED_COLOR_ID_MAX];
d907bc23f70b4c Dan Murphy 2019-09-19 140 int ret;
d907bc23f70b4c Dan Murphy 2019-09-19 141 int i;
a6e4679a09a0a2 Milo(Woogyom Kim 2013-02-05 142)
d907bc23f70b4c Dan Murphy 2019-09-19 143 if (led->mc_cdev.num_leds > 1) {
d907bc23f70b4c Dan Murphy 2019-09-19 @144 led_mc_calc_brightness(&led->mc_cdev,
d907bc23f70b4c Dan Murphy 2019-09-19 145 brightness, adj_value);
d907bc23f70b4c Dan Murphy 2019-09-19 146 for (i = 0; i < led->mc_cdev.num_leds; i++) {
d907bc23f70b4c Dan Murphy 2019-09-19 147 led->brightness = adj_value[i];
d907bc23f70b4c Dan Murphy 2019-09-19 148 ret = cfg->color_intensity_fn(led,
d907bc23f70b4c Dan Murphy 2019-09-19 149 led->grouped_channels[i]);
d907bc23f70b4c Dan Murphy 2019-09-19 150 if (ret)
d907bc23f70b4c Dan Murphy 2019-09-19 151 break;
d907bc23f70b4c Dan Murphy 2019-09-19 152 }
d907bc23f70b4c Dan Murphy 2019-09-19 153 } else {
a6e4679a09a0a2 Milo(Woogyom Kim 2013-02-05 154) led->brightness = (u8)brightness;
d907bc23f70b4c Dan Murphy 2019-09-19 155 ret = cfg->brightness_fn(led);
d907bc23f70b4c Dan Murphy 2019-09-19 156 }
d907bc23f70b4c Dan Murphy 2019-09-19 157
d907bc23f70b4c Dan Murphy 2019-09-19 158 return ret;
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 159) }
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 160)
9e9b3db1b2f725 Milo(Woogyom Kim 2013-02-05 161) static int lp55xx_init_led(struct lp55xx_led *led,
9e9b3db1b2f725 Milo(Woogyom Kim 2013-02-05 162) struct lp55xx_chip *chip, int chan)
9e9b3db1b2f725 Milo(Woogyom Kim 2013-02-05 163) {
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 164) struct lp55xx_platform_data *pdata = chip->pdata;
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 165) struct lp55xx_device_config *cfg = chip->cfg;
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 166) struct device *dev = &chip->cl->dev;
d907bc23f70b4c Dan Murphy 2019-09-19 167 int max_channel = cfg->max_channel;
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 168) char name[32];
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 169) int ret;
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 170)
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 171) if (chan >= max_channel) {
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 172) dev_err(dev, "invalid channel: %d / %d\n", chan, max_channel);
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 173) return -EINVAL;
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 174) }
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 175)
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 176) if (pdata->led_config[chan].led_current == 0)
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 177) return 0;
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 178)
d907bc23f70b4c Dan Murphy 2019-09-19 179 if (pdata->led_config[chan].name) {
d907bc23f70b4c Dan Murphy 2019-09-19 180 led->cdev.name = pdata->led_config[chan].name;
d907bc23f70b4c Dan Murphy 2019-09-19 181 } else {
d907bc23f70b4c Dan Murphy 2019-09-19 182 snprintf(name, sizeof(name), "%s:channel%d",
d907bc23f70b4c Dan Murphy 2019-09-19 183 pdata->label ? : chip->cl->name, chan);
d907bc23f70b4c Dan Murphy 2019-09-19 184 led->cdev.name = name;
d907bc23f70b4c Dan Murphy 2019-09-19 185 }
d907bc23f70b4c Dan Murphy 2019-09-19 186
d907bc23f70b4c Dan Murphy 2019-09-19 187 if (pdata->led_config[chan].num_colors > 1) {
d907bc23f70b4c Dan Murphy 2019-09-19 188 led->mc_cdev.led_cdev = &led->cdev;
d907bc23f70b4c Dan Murphy 2019-09-19 189 led->cdev.brightness_set_blocking = lp55xx_set_brightness;
d907bc23f70b4c Dan Murphy 2019-09-19 190 led->cdev.groups = lp55xx_led_groups;
d907bc23f70b4c Dan Murphy 2019-09-19 191 led->mc_cdev.num_leds = pdata->led_config[chan].num_colors;
d907bc23f70b4c Dan Murphy 2019-09-19 192 led->mc_cdev.available_colors = pdata->led_config[chan].available_colors;
d907bc23f70b4c Dan Murphy 2019-09-19 193 memcpy(led->channel_color,
d907bc23f70b4c Dan Murphy 2019-09-19 194 pdata->led_config[chan].channel_color,
d907bc23f70b4c Dan Murphy 2019-09-19 195 sizeof(led->channel_color));
d907bc23f70b4c Dan Murphy 2019-09-19 196 memcpy(led->grouped_channels,
d907bc23f70b4c Dan Murphy 2019-09-19 197 pdata->led_config[chan].grouped_channels,
d907bc23f70b4c Dan Murphy 2019-09-19 198 sizeof(led->grouped_channels));
d907bc23f70b4c Dan Murphy 2019-09-19 199 } else {
d907bc23f70b4c Dan Murphy 2019-09-19 200
d907bc23f70b4c Dan Murphy 2019-09-19 201 led->cdev.default_trigger = pdata->led_config[chan].default_trigger;
d907bc23f70b4c Dan Murphy 2019-09-19 202 led->cdev.brightness_set_blocking = lp55xx_set_brightness;
d907bc23f70b4c Dan Murphy 2019-09-19 203 } led->cdev.groups = lp55xx_led_groups;
d907bc23f70b4c Dan Murphy 2019-09-19 204
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 205) led->led_current = pdata->led_config[chan].led_current;
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 206) led->max_current = pdata->led_config[chan].max_current;
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 207) led->chan_nr = pdata->led_config[chan].chan_nr;
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 208)
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 209) if (led->chan_nr >= max_channel) {
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 210) dev_err(dev, "Use channel numbers between 0 and %d\n",
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 211) max_channel - 1);
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 212) return -EINVAL;
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 213) }
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 214)
d907bc23f70b4c Dan Murphy 2019-09-19 215 if (pdata->led_config[chan].num_colors > 1)
d907bc23f70b4c Dan Murphy 2019-09-19 @216 ret = led_classdev_multicolor_register(dev, &led->mc_cdev);
d907bc23f70b4c Dan Murphy 2019-09-19 217 else
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 218) ret = led_classdev_register(dev, &led->cdev);
d907bc23f70b4c Dan Murphy 2019-09-19 219
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 220) if (ret) {
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 221) dev_err(dev, "led register err: %d\n", ret);
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 222) return ret;
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 223) }
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 224)
9e9b3db1b2f725 Milo(Woogyom Kim 2013-02-05 225) return 0;
9e9b3db1b2f725 Milo(Woogyom Kim 2013-02-05 226) }
9e9b3db1b2f725 Milo(Woogyom Kim 2013-02-05 227)

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: .config.gz