From patchwork Thu Dec 2 22:27:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 520704 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 7F6F4C4332F for ; Thu, 2 Dec 2021 22:28:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377357AbhLBWcQ (ORCPT ); Thu, 2 Dec 2021 17:32:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377343AbhLBWbx (ORCPT ); Thu, 2 Dec 2021 17:31:53 -0500 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFC63C0613A5 for ; Thu, 2 Dec 2021 14:27:59 -0800 (PST) Received: by mail-pl1-x62b.google.com with SMTP id u17so736076plg.9 for ; Thu, 02 Dec 2021 14:27:59 -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=+JAo2MaGppQnqjiILYakqrQo0dvp6TO6MPFSMqu2Msw=; b=JwC02+ORyfxx4rSWQ3wiTgF2uaijCbmu4Tlo5ffDni05+C8GgWgtOdvlir6pEqQ67/ h/aGHxc974t0pS6wShnNr8fXdq97VS3rmsp3NbQz6XqUwQ9JrlF6GdD1ARgBzKNJRonS nSiOEDFuir9ehlzy5jn7kaOUgSyjlLf+dkazI= 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=+JAo2MaGppQnqjiILYakqrQo0dvp6TO6MPFSMqu2Msw=; b=Y/D5HSQ+4nWi3XVRY+UNeaFlaFZa64BkqaRPvo2JXMlPV3taJZMQ455xdoy65S40wV up4degMt3v+imPsmdjWzsOSeOY9jRCzUKTi/NfB8gPXc2hwyKlPhOdUvrf5P+i0Udt+T RdaMb0W9NURELVssilSoHSGNqHl9mEUEwxc8MGSmdQdFFE0dMKeEq6m5nfJNApoagqo1 I4UEXCmMzahsI84hyptGE6XGu35az4C5kY1fCdPFWsWcn/1MAdfCUDwh6NPdaS3ZYtxG sgzFdZys1GgUgIwjJL6YWg1Ln3VSSYYKTzMEpRet+YG1vXjwOhFGJNhRkJDEkkXTJXHp IOZQ== X-Gm-Message-State: AOAM530mkreygrgVvbtsTUNAigPhYyzTKSOumz90+WMiqrqVnbCxXjou ivIazKNd5kDAKCnKM2ZQNlFspA== X-Google-Smtp-Source: ABdhPJzIvss3OFpbFAl51HKLBYnJVDs+mnPXzZw7MTof1TWzNPmxYxGUZApsvNswjQHVoAiBqk4crA== X-Received: by 2002:a17:90b:4f42:: with SMTP id pj2mr9273117pjb.7.1638484079336; Thu, 02 Dec 2021 14:27:59 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.27.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:27:59 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Sebastian Reichel , linux-pm@vger.kernel.org, Daniel Vetter , Linus Walleij , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v4 28/34] power: supply: ab8500: Migrate to aggregate driver Date: Thu, 2 Dec 2021 14:27:26 -0800 Message-Id: <20211202222732.2453851-29-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@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 Cc: Cc: Daniel Vetter Cc: Linus Walleij 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);