Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BD82C43219 for ; Thu, 6 Jan 2022 21:47:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244452AbiAFVri (ORCPT ); Thu, 6 Jan 2022 16:47:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244698AbiAFVqy (ORCPT ); Thu, 6 Jan 2022 16:46:54 -0500 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4346CC029822 for ; Thu, 6 Jan 2022 13:46:35 -0800 (PST) Received: by mail-pj1-x1031.google.com with SMTP id l16-20020a17090a409000b001b2e9628c9cso4538960pjg.4 for ; Thu, 06 Jan 2022 13:46:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XGqq0UfufzgH1LXDtnLjAQyDmHk5g+0Lk09sKMzlfmI=; b=AOWN7v58HvJOqlZ6lHNZHE2A28mPb4zKe2Mj9bTZpwUh+HozXtTE3jJKFaw47lD3eY 5NtO2Oi1pTx6/Avl2BGK7Xwjzdc8hSPXzduFzhd2fF7rpBHqfzUQDhHs4/BcY7K7tS7F 0U4tA0tg9yLN38FNIeknPel3KIr+eOw+2+HBw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XGqq0UfufzgH1LXDtnLjAQyDmHk5g+0Lk09sKMzlfmI=; b=a6Zwd7or8KfiZe8xz421Bq/RrWRjgNqJOAcD7sjdzDxOIj0Hcc6Q30DtLJLk4GYXjn BHYooR7eVbC0FP1kRpXXzGdUAvSP/kUpzDA0LAKW3nB7g9vzSMjkqsNzH7TLO7CBn8yJ zqS0XDgftjoyQGLVGA3uZyAD2psuDEj2p7kkhQ4nyglb+oF7ISPkqnuwMP7CxYX3Czs6 izY7Ni5McmHLrQVT7G6diCWi3oWzibNftelr5Xb/bXepIxpvsA24hyqAoGXtvz2jl0PZ 2Fl613+s+Rlrxdv39IgcIRg1UFbdXsTek55mD9WHR5izEnKuo6vdfRIInpWkkUJGsFXG +DzQ== X-Gm-Message-State: AOAM531gJRL4CeKT2kVr2BkYVpHG7ItvXcEiVpnsUcBmYZyCjyJKOzoV bmES3FtaX6uPYx4s8P9K22/yzQ== X-Google-Smtp-Source: ABdhPJxsrSp0V86crFp4pzNtzJwdoL0M0g2Krz5WE6X1drEmfa7npHt6A/QP0naMp9HjGxQ1EzBxtQ== X-Received: by 2002:a17:902:ce85:b0:148:d590:5734 with SMTP id f5-20020a170902ce8500b00148d5905734mr60400961plg.1.1641505594793; Thu, 06 Jan 2022 13:46:34 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:34 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Sebastian Reichel , Linus Walleij , linux-pm@vger.kernel.org, Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 27/32] power: supply: ab8500: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:50 -0800 Message-Id: <20220106214556.2461363-28-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Acked-by: Sebastian Reichel Tested-by: Linus Walleij Cc: Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/power/supply/ab8500_charger.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/power/supply/ab8500_charger.c b/drivers/power/supply/ab8500_charger.c index 15eadaf46f14..52d4105e28f2 100644 --- a/drivers/power/supply/ab8500_charger.c +++ b/drivers/power/supply/ab8500_charger.c @@ -3312,8 +3312,9 @@ static const struct power_supply_desc ab8500_usb_chg_desc = { .get_property = ab8500_charger_usb_get_property, }; -static int ab8500_charger_bind(struct device *dev) +static int ab8500_charger_bind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct ab8500_charger *di = dev_get_drvdata(dev); int ch_stat; int ret; @@ -3354,8 +3355,9 @@ static int ab8500_charger_bind(struct device *dev) return 0; } -static void ab8500_charger_unbind(struct device *dev) +static void ab8500_charger_unbind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct ab8500_charger *di = dev_get_drvdata(dev); int ret; @@ -3380,9 +3382,13 @@ static void ab8500_charger_unbind(struct device *dev) component_unbind_all(dev, di); } -static const struct component_master_ops ab8500_charger_comp_ops = { - .bind = ab8500_charger_bind, - .unbind = ab8500_charger_unbind, +static struct aggregate_driver ab8500_charger_aggregate_driver = { + .probe = ab8500_charger_bind, + .remove = ab8500_charger_unbind, + .driver = { + .name = "ab8500_charger_agg", + .owner = THIS_MODULE, + }, }; static struct platform_driver *const ab8500_charger_component_drivers[] = { @@ -3663,9 +3669,7 @@ static int ab8500_charger_probe(struct platform_device *pdev) } - ret = component_master_add_with_match(&pdev->dev, - &ab8500_charger_comp_ops, - match); + ret = component_aggregate_register(&pdev->dev, &ab8500_charger_aggregate_driver, match); if (ret) { dev_err(dev, "failed to add component master\n"); goto free_notifier; @@ -3688,7 +3692,7 @@ static int ab8500_charger_remove(struct platform_device *pdev) { struct ab8500_charger *di = platform_get_drvdata(pdev); - component_master_del(&pdev->dev, &ab8500_charger_comp_ops); + component_aggregate_unregister(&pdev->dev, &ab8500_charger_aggregate_driver); usb_unregister_notifier(di->usb_phy, &di->nb); usb_put_phy(di->usb_phy); -- https://chromeos.dev