Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3359734pxj; Mon, 24 May 2021 05:05:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAFPUZ2d7WNG4vrnHPnkjKD6yyGzhUUXhw1+vFk0p4ISsxrat7Wo9Qq4Q2phGyPE8Ircdg X-Received: by 2002:a05:6e02:1204:: with SMTP id a4mr18502959ilq.158.1621857939117; Mon, 24 May 2021 05:05:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621857939; cv=none; d=google.com; s=arc-20160816; b=zRoAosY1J+uvpzBWq9TbXuP2kww0wjoos95CTyvTkWiMAUJTteNymf4yQ+iiPo/9Lh CJu1xmKSHGoaIhx3u9bVtYLKtQqg46WI6zhexs7XGQzjig1amfRK9/Gj9YZQBJfS67h1 cgonekUTpllxHdd9Y9/OBYU8Ql/rx0G+tOgEWgHLq9zyu1IIs/qc/U5pNtHwo3m41bWO n+GaLcnwuMro4MqdHam+iGd6+x+G7fzcRZoL597Xg33TsDuHFE4s+VNeBPbgc9JbqpmP tqyVcMA+v33fnYUpXh1jAYFmI2tqlkJH6fZLaADNJHGaB0mmxa2BiVXgKNqa61vTXS21 2a9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=odmAS1D60ViFlptv2jz2ezA2bjFPCCZEbAp89OcXbXo=; b=Ggw/C96dM6XFOG5eLEf2v2wkW9eGAnr9m8PNMd6JbamnR0ch1rcuxSB/o6/x6m8b6y oWOCad9fBkH35GbQgq3Aj4Yutt1QjCbjpyDDCopR4HaDu0naLi3benl7j2gGoskoPRsK 3r7uuPcmAeX/9JjKpVbHVYfcBZGgFE60R97i79Tdohl6PVXJqfKQuVSC9XMso2onCmUv ug4unnKwycyYdA84hO/tAySuK4IE1Q/8pYgDRVy3BW2P4dpS8pYlMn735YusazUQiFZG uwL/WV4X2Lzc+cTGH/lTrOXoobb6y6gbcacr/RIucBJdRmINim/oFURIPl63h63uZrjI 4Vkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@svanheule.net header.s=mail1707 header.b=9B1BHRYH; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=svanheule.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k2si13511559ils.162.2021.05.24.05.05.25; Mon, 24 May 2021 05:05:39 -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; dkim=pass header.i=@svanheule.net header.s=mail1707 header.b=9B1BHRYH; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=svanheule.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232110AbhEXMGQ (ORCPT + 99 others); Mon, 24 May 2021 08:06:16 -0400 Received: from polaris.svanheule.net ([84.16.241.116]:59456 "EHLO polaris.svanheule.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232516AbhEXMGN (ORCPT ); Mon, 24 May 2021 08:06:13 -0400 Received: from [IPv6:2a02:a03f:eafb:ee01:cbcc:e481:3e58:4db1] (unknown [IPv6:2a02:a03f:eafb:ee01:cbcc:e481:3e58:4db1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: sander@svanheule.net) by polaris.svanheule.net (Postfix) with ESMTPSA id 57492202EFA; Mon, 24 May 2021 14:04:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svanheule.net; s=mail1707; t=1621857884; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=odmAS1D60ViFlptv2jz2ezA2bjFPCCZEbAp89OcXbXo=; b=9B1BHRYHPxPKJHB2HEVkRPIPIMN1cMHTFaCQ8CzuX9YCMPjAXrfDllbTgByY6WyzPvGMUn dRAbCEWEu0FcGORTHSGLF4LOQVa2KIb+lKUSSFfqoGpRvO+OX4HKKrdMIbJ0vNd+p1pwF0 iIwiing62A4UkDrys6RDUXHtDAJcBPRzWwePx7fWwoyLeDXedv8WOOZYagse4Hy99kMUgU jXSA3nfIJNE37gjl+vyzV+H9p/WH4R+j3V9HVCO8e01K8SLZS/hs3TekCgX7Nq6Nx9gLTW 7zOL9fDeGEE/NYXhi5DUQFQ/QVKFdv7jupk2WThklBzJouay9TeMr3CZAw+MxA== Message-ID: <08375439546c04d32b158c20fb59446c3bbafb46.camel@svanheule.net> Subject: Re: [PATCH v3 6/6] leds: Add support for RTL8231 LED scan matrix From: Sander Vanheule To: Andy Shevchenko Cc: Pavel Machek , Rob Herring , Lee Jones , Mark Brown , Greg Kroah-Hartman , "Rafael J . Wysocki" , Michael Walle , Linus Walleij , Bartosz Golaszewski , Linux LED Subsystem , devicetree , "open list:GPIO SUBSYSTEM" , Andrew Lunn , Linux Kernel Mailing List Date: Mon, 24 May 2021 14:04:42 +0200 In-Reply-To: References: <213ab7580a1d3229d32f7aac67bf4e828612153a.1621809029.git.sander@svanheule.net> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.4 (3.38.4-1.fc33) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2021-05-24 at 13:24 +0300, Andy Shevchenko wrote: > On Mon, May 24, 2021 at 1:34 AM Sander Vanheule wrote: > > > > Both single and bi-color scanning modes are supported. The driver will > > verify that the addresses are valid for the current mode, before > > registering the LEDs. LEDs can be turned on, off, or toggled at one of > > six predefined rates from 40ms to 1280ms. > > > > Implements a platform device for use as a child device with RTL8231 MFD, > > and uses the parent regmap to access the required registers. > > ... > > > +         This options enables support for using the LED scanning matrix > > output > > option Fixed. > > > +         of the RTL8231 GPIO and LED expander chip. > > +         When built as a module, this module will be named leds-rtl8231. > > ... > > > +               interval_ms = 500; > > Does this deserve a #define? Fine by me. Doesn't make a difference for the binary anyway, but it helps document the code a bit. > ... > > > +       ret = fwnode_property_count_u32(fwnode, "reg"); > > +       if (ret < 0) > > +               return ret; > > +       if (ret != 2) > > +               return -ENODEV; > > I would say -EINVAL, but -ENODEV is similarly okay. Any specific reason you think EINVAL is more appropriate than ENODEV? > ... > > > +       int err; > > ret or err? Be consistent across a single driver. I had first used 'err' for both fwnode_property_count_u32() and fwnode_property_read_u32_array(). The former returns "actual count or error code", while the latter is only "error code". And I found it weird to read the code as "does error code equal 2", if I used 'err' as variable name. I've split this up: * addr_count for fwnode_property_count_u32's result * err for fwnode_property_read_u32_array's result Since addr_count is only used before err is touched, I guess the compiler will optimize this out anyway? Best, Sander