Linux-LEDs Archive on lore.kernel.org
 help / color / Atom feed
From: kbuild test robot <lkp@intel.com>
To: Dan Murphy <dmurphy@ti.com>
Cc: kbuild-all@lists.01.org, jacek.anaszewski@gmail.com,
	pavel@ucw.cz, linux-leds@vger.kernel.org,
	linux-kernel@vger.kernel.org, Dan Murphy <dmurphy@ti.com>
Subject: Re: [PATCH v12 04/16] leds: multicolor: Introduce a multicolor class definition
Date: Mon, 14 Oct 2019 14:18:33 +0800
Message-ID: <201910141441.gxBm0pIx%lkp@intel.com> (raw)
In-Reply-To: <20191011130657.4713-5-dmurphy@ti.com>

[-- Attachment #1: Type: text/plain, Size: 10871 bytes --]

Hi Dan,

I love your patch! Yet something to improve:

[auto build test ERROR on j.anaszewski-leds/for-next]
[cannot apply to v5.4-rc3 next-20191011]
[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-v12/20191014-103058
base:   https://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds.git for-next
config: sparc64-allmodconfig (attached as .config)
compiler: sparc64-linux-gcc (GCC) 7.4.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.4.0 make.cross ARCH=sparc64 

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

All errors (new ones prefixed by >>):

>> drivers//leds/led-class-multicolor.c:17:5: error: redefinition of 'led_mc_calc_color_components'
    int led_mc_calc_color_components(struct led_classdev_mc *mcled_cdev,
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from drivers//leds/led-class-multicolor.c:7:0:
   include/linux/led-class-multicolor.h:119:19: note: previous definition of 'led_mc_calc_color_components' was here
    static inline int led_mc_calc_color_components(struct led_classdev_mc *mcled_cdev,
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers//leds/led-class-multicolor.c:182:5: error: redefinition of 'led_classdev_multicolor_register_ext'
    int led_classdev_multicolor_register_ext(struct device *parent,
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from drivers//leds/led-class-multicolor.c:7:0:
   include/linux/led-class-multicolor.h:104:19: note: previous definition of 'led_classdev_multicolor_register_ext' was here
    static inline int led_classdev_multicolor_register_ext(struct device *parent,
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers//leds/led-class-multicolor.c:204:6: error: redefinition of 'led_classdev_multicolor_unregister'
    void led_classdev_multicolor_unregister(struct led_classdev_mc *mcled_cdev)
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from drivers//leds/led-class-multicolor.c:7:0:
   include/linux/led-class-multicolor.h:117:20: note: previous definition of 'led_classdev_multicolor_unregister' was here
    static inline void led_classdev_multicolor_unregister(struct led_classdev_mc *mcled_cdev) {}
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers//leds/led-class-multicolor.c:224:5: error: redefinition of 'devm_led_classdev_multicolor_register_ext'
    int devm_led_classdev_multicolor_register_ext(struct device *parent,
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from drivers//leds/led-class-multicolor.c:7:0:
   include/linux/led-class-multicolor.h:126:19: note: previous definition of 'devm_led_classdev_multicolor_register_ext' was here
    static inline int devm_led_classdev_multicolor_register_ext(struct device *parent,
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers//leds/led-class-multicolor.c:260:6: error: redefinition of 'devm_led_classdev_multicolor_unregister'
    void devm_led_classdev_multicolor_unregister(struct device *dev,
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from drivers//leds/led-class-multicolor.c:7:0:
   include/linux/led-class-multicolor.h:139:20: note: previous definition of 'devm_led_classdev_multicolor_unregister' was here
    static inline void devm_led_classdev_multicolor_unregister(struct device *parent,
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/led_mc_calc_color_components +17 drivers//leds/led-class-multicolor.c

    16	
  > 17	int led_mc_calc_color_components(struct led_classdev_mc *mcled_cdev,
    18					 enum led_brightness brightness,
    19				       struct led_mc_color_conversion color_component[])
    20	{
    21		struct led_mc_color_entry *priv;
    22		int i = 0;
    23	
    24		list_for_each_entry(priv, &mcled_cdev->color_list, list) {
    25			color_component[i].color_id = priv->led_color_id;
    26			color_component[i].brightness = brightness *
    27						  priv->intensity / priv->max_intensity;
    28			i++;
    29		}
    30	
    31		return 0;
    32	}
    33	EXPORT_SYMBOL_GPL(led_mc_calc_color_components);
    34	
    35	static ssize_t intensity_store(struct device *dev,
    36					struct device_attribute *intensity_attr,
    37					const char *buf, size_t size)
    38	{
    39		struct led_mc_color_entry *priv = container_of(intensity_attr,
    40							    struct led_mc_color_entry,
    41							      intensity_attr);
    42		struct led_classdev *led_cdev = priv->mcled_cdev->led_cdev;
    43		unsigned long value;
    44		ssize_t ret;
    45	
    46		mutex_lock(&led_cdev->led_access);
    47	
    48		ret = kstrtoul(buf, 10, &value);
    49		if (ret)
    50			goto unlock;
    51	
    52		if (value > priv->max_intensity) {
    53			ret = -EINVAL;
    54			goto unlock;
    55		}
    56	
    57		priv->intensity = value;
    58		ret = size;
    59	
    60	unlock:
    61		mutex_unlock(&led_cdev->led_access);
    62		return ret;
    63	}
    64	
    65	static ssize_t intensity_show(struct device *dev,
    66				      struct device_attribute *intensity_attr,
    67				      char *buf)
    68	{
    69		struct led_mc_color_entry *priv = container_of(intensity_attr,
    70							    struct led_mc_color_entry,
    71							      intensity_attr);
    72	
    73		return sprintf(buf, "%d\n", priv->intensity);
    74	}
    75	
    76	static ssize_t max_intensity_show(struct device *dev,
    77					   struct device_attribute *max_intensity_attr,
    78					   char *buf)
    79	{
    80		struct led_mc_color_entry *priv = container_of(max_intensity_attr,
    81							    struct led_mc_color_entry,
    82							      max_intensity_attr);
    83	
    84		return sprintf(buf, "%d\n", priv->max_intensity);
    85	}
    86	
    87	static struct attribute *led_color_attrs[] = {
    88		NULL,
    89	};
    90	
    91	static struct attribute_group led_color_group = {
    92		.name = "colors",
    93		.attrs = led_color_attrs,
    94	};
    95	
    96	static int led_multicolor_init_color(struct led_classdev_mc *mcled_cdev,
    97					     int color_id)
    98	{
    99		struct led_classdev *led_cdev = mcled_cdev->led_cdev;
   100		struct led_mc_color_entry *mc_priv;
   101		char *intensity_file_name;
   102		char *max_intensity_file_name;
   103		size_t len;
   104		int ret;
   105	
   106		mc_priv = devm_kzalloc(led_cdev->dev, sizeof(*mc_priv), GFP_KERNEL);
   107		if (!mc_priv)
   108			return -ENOMEM;
   109	
   110		mc_priv->led_color_id = color_id;
   111		mc_priv->mcled_cdev = mcled_cdev;
   112	
   113		sysfs_attr_init(&mc_priv->intensity_attr.attr);
   114		len = strlen(led_colors[color_id]) + strlen(INTENSITY_NAME) + 1;
   115		intensity_file_name = kzalloc(len, GFP_KERNEL);
   116		if (!intensity_file_name)
   117			return -ENOMEM;
   118	
   119		snprintf(intensity_file_name, len, "%s%s",
   120			 led_colors[color_id], INTENSITY_NAME);
   121		mc_priv->intensity_attr.attr.name = intensity_file_name;
   122		mc_priv->intensity_attr.attr.mode = 0644;
   123		mc_priv->intensity_attr.store = intensity_store;
   124		mc_priv->intensity_attr.show = intensity_show;
   125		ret = sysfs_add_file_to_group(&led_cdev->dev->kobj,
   126					      &mc_priv->intensity_attr.attr,
   127					      led_color_group.name);
   128		if (ret)
   129			goto intensity_err_out;
   130	
   131		sysfs_attr_init(&mc_priv->max_intensity_attr.attr);
   132		len = strlen(led_colors[color_id]) + strlen(MAX_INTENSITY_NAME) + 1;
   133		max_intensity_file_name = kzalloc(len, GFP_KERNEL);
   134		if (!max_intensity_file_name) {
   135			ret = -ENOMEM;
   136			goto intensity_err_out;
   137		}
   138	
   139		snprintf(max_intensity_file_name, len, "%s%s",
   140			 led_colors[color_id], MAX_INTENSITY_NAME);
   141		mc_priv->max_intensity_attr.attr.name = max_intensity_file_name;
   142		mc_priv->max_intensity_attr.attr.mode = 0444;
   143		mc_priv->max_intensity_attr.show = max_intensity_show;
   144		ret = sysfs_add_file_to_group(&led_cdev->dev->kobj,
   145					      &mc_priv->max_intensity_attr.attr,
   146					      led_color_group.name);
   147		if (ret)
   148			goto max_intensity_err_out;
   149	
   150		mc_priv->max_intensity = LED_FULL;
   151		list_add_tail(&mc_priv->list, &mcled_cdev->color_list);
   152	
   153	max_intensity_err_out:
   154		kfree(max_intensity_file_name);
   155	intensity_err_out:
   156		kfree(intensity_file_name);
   157		return ret;
   158	}
   159	
   160	static int led_multicolor_init_color_dir(struct led_classdev_mc *mcled_cdev)
   161	{
   162		struct led_classdev *led_cdev = mcled_cdev->led_cdev;
   163		int ret;
   164		int i;
   165	
   166		ret = sysfs_create_group(&led_cdev->dev->kobj, &led_color_group);
   167		if (ret)
   168			return ret;
   169	
   170		for (i = 0; i < LED_COLOR_ID_MAX; i++) {
   171			if (test_bit(i, &mcled_cdev->available_colors)) {
   172				ret = led_multicolor_init_color(mcled_cdev, i);
   173				if (ret)
   174					break;
   175	
   176			}
   177		}
   178	
   179		return ret;
   180	}
   181	
 > 182	int led_classdev_multicolor_register_ext(struct device *parent,
   183					     struct led_classdev_mc *mcled_cdev,
   184					     struct led_init_data *init_data)
   185	{
   186		struct led_classdev *led_cdev;
   187		int ret;
   188	
   189		if (!mcled_cdev)
   190			return -EINVAL;
   191	
   192		led_cdev = mcled_cdev->led_cdev;
   193		INIT_LIST_HEAD(&mcled_cdev->color_list);
   194	
   195		/* Register led class device */
   196		ret = led_classdev_register_ext(parent, led_cdev, init_data);
   197		if (ret)
   198			return ret;
   199	
   200		return led_multicolor_init_color_dir(mcled_cdev);
   201	}
   202	EXPORT_SYMBOL_GPL(led_classdev_multicolor_register_ext);
   203	
 > 204	void led_classdev_multicolor_unregister(struct led_classdev_mc *mcled_cdev)
   205	{
   206		struct led_mc_color_entry *priv, *next;
   207	
   208		if (!mcled_cdev)
   209			return;
   210	
   211		list_for_each_entry_safe(priv, next, &mcled_cdev->color_list, list)
   212			list_del(&priv->list);
   213	
   214		sysfs_remove_group(&mcled_cdev->led_cdev->dev->kobj, &led_color_group);
   215		led_classdev_unregister(mcled_cdev->led_cdev);
   216	}
   217	EXPORT_SYMBOL_GPL(led_classdev_multicolor_unregister);
   218	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 59116 bytes --]

  parent reply index

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-11 13:06 [PATCH v12 00/16] Multicolor Framework v12 Dan Murphy
2019-10-11 13:06 ` [PATCH v12 01/16] dt: bindings: Add multicolor class dt bindings documention Dan Murphy
2019-10-11 13:06 ` [PATCH v12 02/16] dt-bindings: leds: Add multicolor ID to the color ID list Dan Murphy
2019-10-11 13:06 ` [PATCH v12 03/16] " Dan Murphy
2019-10-11 13:06 ` [PATCH v12 04/16] leds: multicolor: Introduce a multicolor class definition Dan Murphy
2019-10-11 19:53   ` Jacek Anaszewski
2019-10-14  6:18   ` kbuild test robot [this message]
2019-10-11 13:06 ` [PATCH v12 05/16] dt: bindings: lp50xx: Introduce the lp50xx family of RGB drivers Dan Murphy
2019-10-11 13:06 ` [PATCH v12 06/16] leds: lp50xx: Add the LP50XX family of the RGB LED driver Dan Murphy
2019-10-11 20:04   ` Jacek Anaszewski
2019-10-14  9:17   ` kbuild test robot
2019-10-19 17:13     ` Jacek Anaszewski
2019-10-21 11:46       ` Dan Murphy
2019-10-11 13:06 ` [PATCH v12 07/16] dt: bindings: lp55xx: Be consistent in the document with LED acronym Dan Murphy
2019-10-11 13:06 ` [PATCH v12 08/16] dt: bindings: lp55xx: Update binding for Multicolor Framework Dan Murphy
2019-10-11 20:15   ` Jacek Anaszewski
2019-10-12  0:54     ` Dan Murphy
2019-10-12 13:32       ` Jacek Anaszewski
2019-10-11 13:06 ` [PATCH v12 09/16] ARM: dts: n900: Add reg property to the LP5523 channel node Dan Murphy
2019-10-11 13:06 ` [PATCH v12 10/16] ARM: dts: imx6dl-yapp4: Add reg property to the lp5562 " Dan Murphy
2019-10-11 13:06 ` [PATCH v12 11/16] ARM: dts: ste-href: Add reg property to the LP5521 channel nodes Dan Murphy
2019-10-11 13:06 ` [PATCH v12 12/16] leds: lp55xx: Add multicolor framework support to lp55xx Dan Murphy
2019-10-11 20:36   ` Jacek Anaszewski
2019-10-12  0:50     ` Dan Murphy
2019-10-12 13:27       ` Jacek Anaszewski
2019-10-11 13:06 ` [PATCH v12 13/16] leds: lp5523: Update the lp5523 code to add intensity function Dan Murphy
2019-10-11 13:06 ` [PATCH v12 14/16] leds: lp5521: Add multicolor framework intensity support Dan Murphy
2019-10-11 13:06 ` [PATCH v12 15/16] leds: lp55xx: Fix checkpatch file permissions issues Dan Murphy
2019-10-11 13:06 ` [PATCH v12 16/16] leds: lp5523: Fix checkpatch issues in the code Dan Murphy
2019-10-11 19:40 ` [PATCH v12 00/16] Multicolor Framework v12 Jacek Anaszewski
2019-10-12  0:48   ` Dan Murphy

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201910141441.gxBm0pIx%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=dmurphy@ti.com \
    --cc=jacek.anaszewski@gmail.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-LEDs Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-leds/0 linux-leds/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-leds linux-leds/ https://lore.kernel.org/linux-leds \
		linux-leds@vger.kernel.org
	public-inbox-index linux-leds

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-leds


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git