Received: by 10.223.185.116 with SMTP id b49csp2380064wrg; Thu, 22 Feb 2018 12:47:50 -0800 (PST) X-Google-Smtp-Source: AH8x227TG2XGx99aRGf7fqrVkjIfl1S55ZLGaSCNvsBtdF0BYTkKKpSnHGv40eMww6585JdsnEX6 X-Received: by 10.101.66.193 with SMTP id l1mr6561773pgp.57.1519332470391; Thu, 22 Feb 2018 12:47:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519332470; cv=none; d=google.com; s=arc-20160816; b=RMC5/1rur2iI1EsQizeUkxY7v4vzCOEBwR1xwwdl3CpusLhgr8WLrTtGIhFGJfYSEt IPHtbSIt6Iae7fljHl24rNm2YH2nz82FDlySMmJa/2VTYWoZoMLvJm9oDvP5q3Q0vU/x 3Z0cpjQUgIh9+Z9ydWq49EpfdSCVUnPTIY4e9Y5euebva7tvZO4mAcANl+jfoRSDR//l fbtAQq0bObIheQci5WUZQWDypOZdf3z9sWjRnc+YvNZVa8t5bZl+3v5Y09J7Jjn6Ym8r dFWeA0P+7uDEyGHBFwhBZVfTuDx08ffU6SGKiYquWBeIL7P+JLe2jbnzWdbRZF/uOJ/g BPpg== 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:dmarc-filter:arc-authentication-results; bh=GAr0nVY3L4WpbVF3yBD2LKWgiDvvwWuQAjFmOQoDBOE=; b=kk62sTP3wttLvYpOHuhH65d6AzUea/FhA6hEgaOSaSSxXiS9UA453HGNPMFJikWeTo B+1DOn/oRk2adJsvY8NRiigR28mK5wdxv5ZLnt3IDBy19m4ZBHL5s8OPsTYw/h5Hbctm i44DoS7rOFNFlA8sa+aaIHHVnBKnsNPkVRkjZljoA91U5Xhy1tj2I11omHllJJLZZu5P XUwb36gU1g66keq0XhOgeUwa8dTxqA3QdI6brWLI8u5IrDeJOsgVFx1pb06YMcb2iEzW Ue6SsAuOpxXjidbZZRzr43idjohOR4Qq/CaI4ULEf3jkgf8KCxnGOx8f+mr51OrIPXai eZtw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h11si482505pgq.28.2018.02.22.12.47.35; Thu, 22 Feb 2018 12:47:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751429AbeBVUqU (ORCPT + 99 others); Thu, 22 Feb 2018 15:46:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:57640 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751119AbeBVUqT (ORCPT ); Thu, 22 Feb 2018 15:46:19 -0500 Received: from mail.kernel.org (unknown [185.189.112.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2CC3821741; Thu, 22 Feb 2018 20:46:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2CC3821741 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=sre@kernel.org Date: Thu, 22 Feb 2018 21:46:15 +0100 From: Sebastian Reichel To: "Pierre Bourdon (delroth)" Cc: Andy Shevchenko , Andre Heider , Linux PM , Linux Kernel Mailing List Subject: Re: [PATCH] max17042: propagate of_node to power supply device Message-ID: <20180222204615.ogyplmoq5oxpudtk@earth.universe> References: <20180220150318.138827-1-delroth@google.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="26ephqnfeu7zwo66" Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --26ephqnfeu7zwo66 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Tue, Feb 20, 2018 at 06:58:56PM +0100, Pierre Bourdon (delroth) wrote: > On Tue, Feb 20, 2018 at 6:34 PM, Andy Shevchenko > wrote: > > On Tue, Feb 20, 2018 at 5:03 PM, Pierre Bourdon wr= ote: > >> max17042_get_status uses the core power_supply_am_i_supplied. That > >> function relies on DT properties to figure out the power supply > >> topology, and will error out without DT. > > > >> + psy_cfg.of_node =3D dev->of_node; > > > > Perhaps do this in general manner, see how GPIOLIB takes care of it: > > > > $ git grep -n -A4 -w CONFIG_OF_GPIO -- drivers/gpio/gpiolib.c > > drivers/gpio/gpiolib.c:1161:#ifdef CONFIG_OF_GPIO > > drivers/gpio/gpiolib.c-1162- /* If the gpiochip has an assigned OF > > node this takes precedence */ > > drivers/gpio/gpiolib.c-1163- if (chip->of_node) > > drivers/gpio/gpiolib.c-1164- gdev->dev.of_node =3D chip->of_= node; > > drivers/gpio/gpiolib.c-1165-#endif > > ... >=20 > Makes sense. From a quick look in existing drivers, it looks like the > only values being used currently as psy_cfg.of_node are the nodes from > the parent device, so it seems like it could be made generic. >=20 > Are we aware of any driver that is not propagating the of_node on > purpose? Is this something that should be supported? If not, I guess > we could get rid of power_supply_config.of_node and always use the one > from the parent device in __power_supply_register. >=20 > (I'm very new to this codebase, sorry for the possibly dumb questions!) I think it makes sense to keep psy_cfg.of_node in case a driver needs to use a subnode for some reason. I think it makes sense to use dev->of_node as default value, though. Anyways I have applied this patch to my fixes branch. -- Sebastian --26ephqnfeu7zwo66 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE72YNB0Y/i3JqeVQT2O7X88g7+poFAlqPLBcACgkQ2O7X88g7 +ppjFA/+PRt8FMjEIR1vVxiTVLez1RlvQjwONxqN4dWZ9tcCQC0uRwBOUp0vfEiP tQA/oqn/ixaiezlDRTw9p8OVxe0olbV4FCn1hcOg8FhEV4KrHsDA35mC/306XRqD zJql2WqNH/a77xSIuXAKTv9yNClLwXMnR/owBsF7iQBLvi4ntlUlY0lDBL9t8YFk LqduDO8dOeKj9XtjH/C5KxvZ9+AWi34CiMr6a2/OYggPpNMqwmB6AXgtnuv0uXmK 3IXCDv5peb0zN/7vlbXPdNBokdePuptubQflWF8NqX9ZAyW7UmnJ2k1bqTUT33yb L6toWlw2Sv/3EwsaDPzaIhhmxMY10F/F9YFi+D10HkVqDYNGSlPSDiuue1RpW4uL gz35bFWXPbkzppZX+5h6OZL9mEp6+D01XkL+dqcvXxXSezyoSVN4vZ95y4q6N3G3 dDmcM65Ed2kqpm+aAY9Bl0rcxm0k6d6ODqOVs6lU2anWRDX0WEW72EtEqJWclEoF anCmEXdObmTM6jTDX29vOLFeu0alTiP+4Vs/nzenWk2IlqCaUz0JSF1KDiCHdxSN 3hRahF+RGOsEzY7AUNoaysemKS0A9VJGAciXVIedcfOgGbpUKOxZPuk5E3U4HHbw sVGdPdVDrvncynvl85SXHg3jkZf09ShMOBKUrLRLfvwIzHRIzPw= =AY/4 -----END PGP SIGNATURE----- --26ephqnfeu7zwo66--