Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp1354558imw; Tue, 5 Jul 2022 08:03:47 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tFmdkBnlziVAV8ILgVfGFWnjTYuwPSma15Cbg+H022KYgz8qJFg3GKOHmhS6mgTxmKzfNA X-Received: by 2002:a17:902:d4d1:b0:16b:ec24:5a22 with SMTP id o17-20020a170902d4d100b0016bec245a22mr7041399plg.138.1657033426955; Tue, 05 Jul 2022 08:03:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657033426; cv=none; d=google.com; s=arc-20160816; b=iyt4OlvKYkl8f2LWnVjcdthMMRXn5SU5/MZfXaeRB5akhvdIHrViXjFbqIkB1NJK+I Iyg7Vy1Z1pWyLIwuSb4VFeoEQlvNa7oRDDe7Nm81/tP29VXhJvdDP2zRO4p6p4lo4Mie R5fKcWd0+7V3LpYOZHew1dRgvE8cE97VmCUUNvNdk4ZALYVBgYZfdbqXFEFMdSSe2kYj +sqCkDmOtFblWSCwbQvsOZumck2N0/HyvL9meXGJqeUKEDvMOIrJH5EWrigzzPApCnj/ hgPTBBDv9r2lybZeHcGjgNbQ6+iQjye4b/qswOnJXFulDdL72F6lb6vZIDwRmykecB71 z2Jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=2Uu9hwOGiD/JMtKy0CbMp9uQfluVDVZ6jIujueeyIoM=; b=C3qHXtdTDsQcqLiW/gQorDZaj0XJgZaqvVV2s8wPiPSLTyZX4Ody/5C+4BvQknB5Kd 0qC9vgBiRycAPopZM7vAyeP2ZqSR5UJK6Oxl8OZvCRjnvRTy5gmT7vBjKfpyb8MnfLir eBlldMNvBdsiJKVrjBj4M39Djmr8KXBl2abTqhhjIyh6XC1qlcQn5dKskZ4fLCc57WO7 MoT1/gg3uJWN53DplbQUAaYPRFAYvFdeBrNyvLorRXP+nFrpNfTSFhk2bu/trmGGHB2g mdF9aXurECWSWdXejmulZrd1rz0YitvGe13Al94aeIpOekzEIt0wNhCTBVWiYGuBvnQ6 JyEA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q11-20020a056a00084b00b0050dcc1acf09si20107219pfk.111.2022.07.05.08.03.32; Tue, 05 Jul 2022 08:03:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231305AbiGEOGb (ORCPT + 99 others); Tue, 5 Jul 2022 10:06:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231266AbiGEOGN (ORCPT ); Tue, 5 Jul 2022 10:06:13 -0400 Received: from mail-yw1-f169.google.com (mail-yw1-f169.google.com [209.85.128.169]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFC5423177; Tue, 5 Jul 2022 06:54:18 -0700 (PDT) Received: by mail-yw1-f169.google.com with SMTP id 00721157ae682-31caffa4a45so37967517b3.3; Tue, 05 Jul 2022 06:54:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2Uu9hwOGiD/JMtKy0CbMp9uQfluVDVZ6jIujueeyIoM=; b=BgGc6D7gEM0HWTm9uPgGgWrhgTWFpvEa16JmksTk2RR2hj4++kLV1RTG/tNKdArAaG Eq0z9QBj76W8jQcYTWHOE2tjnf+FK3OCZOWMeZLVhiMJ67aQxyaGHxQWjJRFubqVoR4z oaE5Y+I3wLM+XFXUIxuFQZ+MUrtSyQO83pYmUZNgAvYhBtKQR98lOlXlsg+LVP6HnN8Q V9og1bFkgNun06C4P3g46UgWOyPP/Lz8foY5rmeBd/z2obVXea+vp7O6i2xOJWtr+eyK Ua11c3SS1CK5XtK0b++f7vPY48WzsBBecqohJl/+0ObwBLjKk8FiT33qFFBjJJZSPBwL ZQgQ== X-Gm-Message-State: AJIora/ckW7TIQpDQJu1Fhb962gXIhpS6bJ5dur1z7UAWNr6fr5xkv5V usgSOAQmL/0yMOSjQzYFhoxoxgRi6jCQJOPog5o= X-Received: by 2002:a81:17d0:0:b0:31c:c5e2:fc1e with SMTP id 199-20020a8117d0000000b0031cc5e2fc1emr3841737ywx.196.1657029257826; Tue, 05 Jul 2022 06:54:17 -0700 (PDT) MIME-Version: 1.0 References: <12026357.O9o76ZdvQC@kreacher> <2657553.mvXUDI8C0e@kreacher> <5606189.DvuYhMxLoT@kreacher> <61fbd71b-9c36-345c-7aed-561b81c34259@huawei.com> <71dfc3cd-c2ae-8096-9280-67e77c21055e@huawei.com> <050e5a2f-42b9-f851-ec6e-e2a9d3fdbe1c@huawei.com> In-Reply-To: <050e5a2f-42b9-f851-ec6e-e2a9d3fdbe1c@huawei.com> From: "Rafael J. Wysocki" Date: Tue, 5 Jul 2022 15:54:04 +0200 Message-ID: Subject: Re: [PATCH v3] hisi_lpc: Use acpi_dev_for_each_child() To: John Garry Cc: Andy Shevchenko , "Rafael J. Wysocki" , "Rafael J. Wysocki" , Linux ACPI , LKML , Andy Shevchenko , Greg Kroah-Hartman , Yang Yingliang Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 5, 2022 at 12:16 PM John Garry wrote: > > On 05/07/2022 10:39, Andy Shevchenko wrote: > > On Tue, Jul 5, 2022 at 11:38 AM Andy Shevchenko > > wrote: > >> On Tue, Jul 5, 2022 at 10:37 AM John Garry wrote: > >>> On 04/07/2022 20:02, Rafael J. Wysocki wrote: > >> ... > >> > >>> I gave these a quick test on my board and they look fine. > >>> > >>> Acked-by: John Garry > >> John, I believe now you may send a formal clean up to convert to platform_device > > Hit Enter too early:-) > > > > ...to platform_device_register_full(). > > Sure, I can look at that now. But I just found where we previously > mentioned the possibility of factoring out some of the ACPI platform > device creation code: > > https://lore.kernel.org/linux-acpi/CAHp75VfOa5pN4MKT-aQmWBwPGWsOaQupyfrN-weWwfR3vMLtuA@mail.gmail.com/ > > There is actually still a comment in the hisi_lpc driver - I should have > checked there first :) > > So my impression is that the hisi_lpc code is almost the same in > acpi_create_platform_device(), apart from we need do the resource fixup > in hisi_lpc_acpi_set_io_res(). > > So we could factor out by dividing acpi_create_platform_device() into 2x > parts: resource get and then platform dev create. But that does not seem > wise as we have 2x parts which don't make sense on their own. Or else > pass a fixup callback into acpi_create_platform_device(). Any other > ideas if we want to go this way? Personally, I would do the cleanup that can be done without refactoring the library function as the first step, just to reduce the amount of changes made in one go if nothing else. Next, I'd look at introducing something like acpi_create_platform_device_ops(struct acpi_device *adev, const struct property_entry *properties, const struct *platform_device_create_ops *ops); where ops would be a set of callbacks to invoke as a matter of customization. Then, acpi_create_platform_device() can be defined as a wrapper around the above.