Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp609791pxk; Wed, 9 Sep 2020 14:00:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzE+8GD+lZfTipib6th0iZ4Fj721LqALoKtuGUm5+MtUI93d94L4P8GP9U75KiAFqdY8VuH X-Received: by 2002:a50:aa94:: with SMTP id q20mr5919501edc.119.1599685209186; Wed, 09 Sep 2020 14:00:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599685209; cv=none; d=google.com; s=arc-20160816; b=N4osrbvIb+Av/c/Ms6Ol0Xhf+ELPl8A3/rXdc5xWcbgPhrZ2xOtbV7HEiPBY95vOfP lHG59XGM44oULaJ1pUyCrgan1LTicnwNmdFoE/OG99N4XEGXyVmsyvnb9cncR0AWWBwI 46O97BQ0peYlADasIgCpeOjl2+dr/Ft5XihnoxVawxkSeBdOaENze+/Ee0Jt9asHY5Kh Bn2P2hyJq/uHGCZe6U6tyOW+nZ1B+nYyFbMbpkg7FvFfYyKcDnHKyEmT/BRazClVHIQe LXiRqRwLl+LeonKGtIx6IRI6bxd0HHZDPbp5wyYnW2U5QAzlsopx3yqxdcTZWrJ7WYMU 8mLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=KHzg2+YAiGSA4YWN2PJ2pfGUwacDhShpSwBWP173QHk=; b=jfiK4WsI7chX98oC2TvXKvx+2uqQlDGreUyKFePbCL+5HLtoG8qhC+yPBjJMd6kFgD RQHapwhNEO44Kg7wv4avokl4Z2B9bww6xSDhQYWc8808GhNsvdgAuUlYF0iVa6JVtdNM 6lz5OB820uAGsgnL7BaF4xFW+PGl+BujbwoM1Uf7Qe27lP+SR37P69bRvlciXEvLz14C tEnO+ck33RE4Ix6EFi78qa903Z8KVkr6UUnVdMATYM7BiIcSDLoZW1aAs9JYBjEkOpab QZo1WhwIWYSOUtdKQ2qyR8EFlqZBzihZ5XrBtJpnrD/pT6UJWC3ui8UohDs7lmX7hhWP +lxw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bi26si2227467ejb.361.2020.09.09.13.59.46; Wed, 09 Sep 2020 14:00:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728207AbgIIU7A (ORCPT + 99 others); Wed, 9 Sep 2020 16:59:00 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:39914 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726414AbgIIU67 (ORCPT ); Wed, 9 Sep 2020 16:58:59 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 0A6141C0B8C; Wed, 9 Sep 2020 22:58:56 +0200 (CEST) Date: Wed, 9 Sep 2020 22:58:55 +0200 From: Pavel Machek To: Jacek Anaszewski Cc: linux-leds@vger.kernel.org, devicetree@vger.kernel.org, Dan Murphy , Rob Herring , linux-kernel@vger.kernel.org, Alexander Dahl Subject: Re: [PATCH v3 1/2] leds: pwm: Allow automatic labels for DT based devices Message-ID: <20200909205855.GC20388@amd> References: <20200907043459.2961-1-post@lespocky.de> <20200907043459.2961-2-post@lespocky.de> <20200909090736.GE10891@amd> <20200909202907.3z425uujvu532qxs@falbala.internal.home.lespocky.de> <9e78d793-d0d5-737c-163e-30736c1c7bdf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="YD3LsXFS42OYHhNZ" Content-Disposition: inline In-Reply-To: <9e78d793-d0d5-737c-163e-30736c1c7bdf@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --YD3LsXFS42OYHhNZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > >>> pwm_init_state(led_data->pwm, &led_data->pwmstate); > >>>- ret =3D devm_led_classdev_register(dev, &led_data->cdev); > >>>+ if (fwnode) { > >>>+ init_data.fwnode =3D fwnode; > >>>+ ret =3D devm_led_classdev_register_ext(dev, &led_data->cdev, > >>>+ &init_data); > >>>+ } else { > >>>+ ret =3D devm_led_classdev_register(dev, &led_data->cdev); > >>>+ } > >> > >>Can you always use _ext version, even with null fwnode? > > > >I did not try on real hardware, but from reading the code I would say > >the following would happen: led_classdev_register_ext() calls > >led_compose_name(parent, init_data, composed_name) which itself calls > >led_parse_fwnode_props(dev, fwnode, &props); that returns early due to > >fwnode=3D=3DNULL without changing props, thus this stays as initialized > >with {}, so led_compose_name() would return -EINVAL which would let > >led_classdev_register_ext() fail, too. > > > >>If not, can you fix the core to accept that? Having that conditional > >>in driver is ugly. > > > >It is ugly, although the approach is inspired by the leds-gpio driver. > >I'll see if I can come up with a change to led-core, but I'm also open > >for suggestions. ;-) >=20 > devm_led_classdev_register() calls devm_led_classdev_register_ext() > with NULL passed in place of init_data, so you could do something like > below to achieve the same without touching LED core: >=20 > struct led_init_data init_data_impl =3D { .fwnode =3D fwnode }; > struct led_init_data *init_data =3D NULL; >=20 > if (fwnode) > init_data =3D &init_data_impl; >=20 > devm_led_classdev_register_ext(dev, &led_data->cdev, init_data); Umm.. This is not too great, either. Maybe I'd really prefer the change to the LED core. > >fyi: Peter Ujfalusi answered and would give his Ack to the changed > >dual license for the yaml file. You can expect that for v4. Good :-). Best regards, pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --YD3LsXFS42OYHhNZ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAl9ZQg8ACgkQMOfwapXb+vL3CQCfQDic/R/0EPuqdZppwuv6RMsq 0BMAn2rBwwlrIBuBpn2c87MeB4P04Hsj =tb6i -----END PGP SIGNATURE----- --YD3LsXFS42OYHhNZ--