Received: by 10.223.185.116 with SMTP id b49csp921993wrg; Tue, 20 Feb 2018 09:59:55 -0800 (PST) X-Google-Smtp-Source: AH8x227FvP8ysWmgLkZrKAGEKNPdJnGUm/Lwoz0qfD9u3ECkX1w1YKZqDcvgdU9w5+TnMUL3us0W X-Received: by 2002:a17:902:1:: with SMTP id 1-v6mr402954pla.187.1519149595682; Tue, 20 Feb 2018 09:59:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519149595; cv=none; d=google.com; s=arc-20160816; b=lsNTykljbVp1iKoOOtEXcEUlhJVLzTsAM//IpOulgZou7sKk1wbOxFSvxT4iGhfFC0 tjLwOl/JR8IU1x6IiwDzwcxCuOFaC5Tyk6l2eZZVjysrHm96ONGZHMngVYZ8Rfc3aqL4 fCBrM1cA41dGJbqwdkatZFRgnxIS2CI8s4AthgkU89+ATtjvKlCZVi9bEtVlmC6bO/DY aPYkl76yusHh8Tpey+6zePttTEmW6nTmQE3NLmIm1o4b5eUvSO7u6AH/cuOOwk8hsHBu OXxPZQcpxcD26gxpYLHzty+LJhCRjaTR6JPNdEFcEKiluvn1yqYjS5N2ygwFPkIXh+w9 aSDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=bJ6CM83oiQHpPdDRMh1w8R7A1pA6gQ56hwrcocot43A=; b=wk1k4R+1nlybzGdYvic1Qn+OY/3mdvNkzMEKkLkZb7ihotWDws/+hvWqdEnQ7Xrsvf q1VdKrLQoHDvTkRcF7smiu2jGgg0ns3eqaUuynqZRvqdlND44Fkc23SHQseiWUqaBbDS dtVDoYXLrXfS17/gc0MHfvJi4NTTbTOs6IasXguERvomdhPKI5pb4kBisJntPA/yfcMp 9RustqaIgogvdBRyall0JBUQ4Jsa4E4IPeLawUyUr7OhKFUpuDKgCQ6tyvTDlI8+PjAn o8Z0ih0gCTT/OehbBe/QtSwFmaglsAkMtEJ8I4O7ciRisUQ7l2qot2s48+H77Dx1u54S oAYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=TjPrwka5; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 23si2981658pfs.322.2018.02.20.09.59.40; Tue, 20 Feb 2018 09:59:55 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=TjPrwka5; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752431AbeBTR7A (ORCPT + 99 others); Tue, 20 Feb 2018 12:59:00 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:36262 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751381AbeBTR66 (ORCPT ); Tue, 20 Feb 2018 12:58:58 -0500 Received: by mail-wr0-f194.google.com with SMTP id u15so16921639wrg.3 for ; Tue, 20 Feb 2018 09:58:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=bJ6CM83oiQHpPdDRMh1w8R7A1pA6gQ56hwrcocot43A=; b=TjPrwka5auGN4xUpOFTbY/T/E8aSpohpHeN9zJ34I7dWPMlGqs75F7KnRcxjRtGS5N Pn9tgNNHplzMX0IzZZ1ORtk+DpWGRGEw1suTNQpspmczO5kiisGfAxbr4jjubRcA3Uf5 t8+IUml+5BZVNXxxd2b+q5KMozb8ylX0dKJOzjNiyrsJci8XuLBHYXtLgCn+/r1S40IP q7cvXsIM1waZNHFAVg9JhWlAKRGNl29os0J+QrztF18wl8X5wCs1v02ar20XXHTTdS6E oaHVgLzBPNCg3oXMJFYWZlqEnOjoY2LQ+WHzTs6ZiYq/6GW0Itcs870qCRnw3iIG+xTj ls6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=bJ6CM83oiQHpPdDRMh1w8R7A1pA6gQ56hwrcocot43A=; b=jPMbSM1QU3kgn2pAR788dazi4SDEYa/H1yx+28s+veXaXiI3x8gLEDFwyWEtMYr6Df usdzgsyrP+gw48Y6cmPkexiEkJ+N8OxkfQtuxENIPXaUCAQUgHFlQH3eR423ctfxLOzu 5jXescG9IFjZXLRdVZ20UiqRWmbx5NzcmLURi3mznYVSfmQeOdhRNDIqXqPJeIw7al8y /po7xn3j6++leNDFwXCmtwQkFwr3PuZGw7aA9ewOvfdhDWx7afWt+I603qN+NOuiUedP OpZAG9W/15egF7cx2hV5P12eIVqjXxeCP9D2fu/J33AWBGlN8bn672CDxMFvUqHipzr0 5YUQ== X-Gm-Message-State: APf1xPAKCstbiZzHw6bjWTzjxixxg0yhNtlVkPB2LwF7n7P61VMsl+xp S+DcT8htQpkANS42AY2YxhED+PMprZ9WO6vXbjYdEQ== X-Received: by 10.80.165.34 with SMTP id y31mr1331950edb.261.1519149536916; Tue, 20 Feb 2018 09:58:56 -0800 (PST) MIME-Version: 1.0 Received: by 10.80.231.136 with HTTP; Tue, 20 Feb 2018 09:58:56 -0800 (PST) In-Reply-To: References: <20180220150318.138827-1-delroth@google.com> From: "Pierre Bourdon (delroth)" Date: Tue, 20 Feb 2018 18:58:56 +0100 Message-ID: Subject: Re: [PATCH] max17042: propagate of_node to power supply device To: Andy Shevchenko Cc: Andre Heider , Sebastian Reichel , Linux PM , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 20, 2018 at 6:34 PM, Andy Shevchenko wrote: > On Tue, Feb 20, 2018 at 5:03 PM, Pierre Bourdon wrote: >> 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 = 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 = chip->of_node; > drivers/gpio/gpiolib.c-1165-#endif > ... 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. 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. (I'm very new to this codebase, sorry for the possibly dumb questions!) -- Pierre Bourdon (delroth@)