From: Luca Weiss <luca@z3ntu.xyz> To: Pavel Machek <pavel@ucw.cz> Cc: linux-leds@vger.kernel.org, Dan Murphy <dmurphy@ti.com>, Heiko Stuebner <heiko@sntech.de>, Icenowy Zheng <icenowy@aosc.io>, Jacek Anaszewski <jacek.anaszewski@gmail.com>, Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Mark Rutland <mark.rutland@arm.com>, Maxime Ripard <mripard@kernel.org>, Rob Herring <robh+dt@kernel.org>, Shawn Guo <shawnguo@kernel.org>, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht Subject: Re: [PATCH v3 2/2] leds: add sgm3140 driver Date: Mon, 27 Apr 2020 21:49:54 +0200 Message-ID: <318932736.Jt2qlLCP7m@g550jk> (raw) In-Reply-To: <20200427095102.GA21572@duo.ucw.cz> [-- Attachment #1: Type: text/plain, Size: 2117 bytes --] On Montag, 27. April 2020 11:51:02 CEST Pavel Machek wrote: > Hi! > > > Add a driver for the SGMICRO SGM3140 Buck/Boost Charge Pump LED driver. > > > > This device is controlled by two GPIO pins, one for enabling and the > > second one for switching between torch and flash mode. > > > > Signed-off-by: Luca Weiss <luca@z3ntu.xyz> > > Thanks, applied, but... I may remove it again. > > > +++ b/drivers/leds/leds-sgm3140.c > > @@ -0,0 +1,320 @@ > > +// SPDX-License-Identifier: GPL-2.0 > > Would you consider GPL-2+? I don't really have a preference either way but GPL-2.0-or-later is fine for me. > > > +#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS) > > +static void sgm3140_init_v4l2_flash_config(struct sgm3140 *priv, > > Ok. > > > +static int sgm3140_probe(struct platform_device *pdev) > > +{ > > ... > > > + led_cdev->brightness_set_blocking = sgm3140_brightness_set; > > + led_cdev->max_brightness = LED_ON; > > Don't do this, unless you really have 255 levels of brightness. LED_ON is 1, so the brightness available is 0 - 1. > > > + /* Create V4L2 Flash subdev */ > > + priv->v4l2_flash = v4l2_flash_init(&pdev->dev, > > + child_node, > > + fled_cdev, NULL, > > + &v4l2_sd_cfg); > > + if (IS_ERR(priv->v4l2_flash)) { > > Does this need some #ifdef guards? v4l2_flash_init has a NULL-returning version when CONFIG_V4L2_FLASH_LED_CLASS is not defined (see https://elixir.bootlin.com/linux/latest/source/include/ media/v4l2-flash-led-class.h#L166 ) > > > + ret = PTR_ERR(priv->v4l2_flash); > > + goto err; > > + } > > + > > + return ret; > > Should this return 0? ret should be 0 here, so it shouldn't matter much. > > > +err: > > + fwnode_handle_put(child_node); > > + return ret; > > +} > > Does non-error path needs handle_put, too? I don't think so, I'm passing child_node to v4l2_flash_init which then saves the pointer to v4l2_subdev->fwnode. The devm_led_classdev_flash_register_ext function also seems to store the pointer (led_cdev->dev->fwnode = init_data->fwnode; in led_classdev_register_ext) > > Best regards, > Pavel Regards, Luca [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply index Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-04-21 19:13 [PATCH v3 0/2] Add sgm3140 flash led driver Luca Weiss 2020-04-21 19:13 ` [PATCH v3 1/2] dt-bindings: leds: Add binding for sgm3140 Luca Weiss 2020-04-21 19:13 ` [PATCH v3 2/2] leds: add sgm3140 driver Luca Weiss 2020-04-27 9:51 ` Pavel Machek 2020-04-27 19:49 ` Luca Weiss [this message] 2020-04-27 21:10 ` Jacek Anaszewski
Reply instructions: You may reply publicly 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=318932736.Jt2qlLCP7m@g550jk \ --to=luca@z3ntu.xyz \ --cc=devicetree@vger.kernel.org \ --cc=dmurphy@ti.com \ --cc=heiko@sntech.de \ --cc=icenowy@aosc.io \ --cc=jacek.anaszewski@gmail.com \ --cc=laurent.pinchart@ideasonboard.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-leds@vger.kernel.org \ --cc=mark.rutland@arm.com \ --cc=mripard@kernel.org \ --cc=pavel@ucw.cz \ --cc=robh+dt@kernel.org \ --cc=shawnguo@kernel.org \ --cc=~postmarketos/upstreaming@lists.sr.ht \ /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
LKML Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git git clone --mirror https://lore.kernel.org/lkml/9 lkml/git/9.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \ linux-kernel@vger.kernel.org public-inbox-index lkml Example config snippet for mirrors Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel AGPL code for this site: git clone https://public-inbox.org/public-inbox.git