Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp818243rwb; Thu, 18 Aug 2022 12:49:55 -0700 (PDT) X-Google-Smtp-Source: AA6agR4Y7GRnBUgVJGbTidk+2EdTkcUDlOL8ZkbfcTz3857RIUxszXjI3QinnTEWbZKtVPn3JyE9 X-Received: by 2002:a17:90b:35c3:b0:1f5:8a88:3b94 with SMTP id nb3-20020a17090b35c300b001f58a883b94mr10037058pjb.201.1660852195003; Thu, 18 Aug 2022 12:49:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660852194; cv=none; d=google.com; s=arc-20160816; b=QE8FXKg3nXA7eB2pYL4SRlNH5585NdZE+Uo9QRbGss3Trw8+6uSgvt2RaAItmY1Ph6 UrC+HGdge8UoXL9rjlYvrkGHrkGpGUjxVQsoK2hcfBsQBEj0aBgX5auC9kROZbRGG/2W jSiDDkxZXpBu3GGGkVl2bVYkjXmPlvdChYlHXL2ya4oXkicIx1unahvxwyGYf9rBUnJ1 g2NbecFdBUYznSIpNtzl4mw1Wz+Xbk0X24qo6tlxnOzFuVUMme20BoIieT3HPqS/yPPH MRumfihSQk2YO7U4PlTu1TBo8ZhxPC138wTArJgE7fkKZUG9xA5dwHBlwDGtU59Hf/oG fLdQ== 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:dkim-signature; bh=Vyt7thzr39zGzD+jwdjbrUMpFKsnWCaeVnONmE4AFgo=; b=kJafpiFxpOVS65KJ5pQQJwoDaUvup+ZiDy+QiyPoD0dRwTc6ASThdAbSV1brMQBBP7 FkpMgEX/R5ArF0YoAvRy9L9CykeM43fDHbUKTlfBT8Qs8/5TTvWlszxNC+8uo6vN7ISv fv1QImo5MzQT4JJsjtMkM+yujRwwukdGRyKWV5tzMq8VvR44X9TO6cn5kFp8RXoxlffk 0gfk9Rapo/4GH2lgkEFtdDZZdzcLoqtbSF3rVM93HfEnqSxU3farVldrmUl7DFQzocce qPA/Qs7aBtF3r6me92dic/tmfn/vlB8KajIafU1rkPdM6TtDbu00iRHxuTFChWB+eIvN 27Yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ZaAxj2QM; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w4-20020a656944000000b00414df77f608si2339348pgq.239.2022.08.18.12.49.43; Thu, 18 Aug 2022 12:49:54 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ZaAxj2QM; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343534AbiHRTly (ORCPT + 99 others); Thu, 18 Aug 2022 15:41:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232038AbiHRTlv (ORCPT ); Thu, 18 Aug 2022 15:41:51 -0400 Received: from mail-qk1-x72a.google.com (mail-qk1-x72a.google.com [IPv6:2607:f8b0:4864:20::72a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0294D0221; Thu, 18 Aug 2022 12:41:50 -0700 (PDT) Received: by mail-qk1-x72a.google.com with SMTP id a15so1917298qko.4; Thu, 18 Aug 2022 12:41:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=Vyt7thzr39zGzD+jwdjbrUMpFKsnWCaeVnONmE4AFgo=; b=ZaAxj2QMNxNhWbyxxYbh/wlzc/lpYiubkJrWfBxxjEfKiHktq4rm02nEIXrkN8VFun 1tRITvqVUBVN9GNgwp9AbLrwVQSXbg5LwG2PCo+3jpvlGkms8M0URVFecJn0SfNKxjYv 3GeRd4GhGgGXpekECxGR/ZuNKN0eGiEIogh1YrKwKmJFS4ta+ILQD7b0GGpScYI6vwmT 8wRAhYJH9Tu3YfsXGbS91FMH6F+YkKRfVL3vbfk2hEYthFocbBNBkzmwv8v8bdlu20GP O6Ul9o7QjPt9kwTh+Z3BgwPmistP029PrzXxoi++xfWN82b99hOHFd9LUXM7Y+GulQ2f Xj2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=Vyt7thzr39zGzD+jwdjbrUMpFKsnWCaeVnONmE4AFgo=; b=KsQXvHI1BvQSAmJijyfBFbmaN7mI+A9mSjCygkdivIVMu19ub5ZxS5Ck0dUrGX3QVT LbY89MlhNPRHClNQaMIdd7nleOQ5lp3FiDgkMSqRjTnDk+MXbEdXcxGWjJvRN8QrvG7/ mWUyw5QplSxqO/ffv3/K6cCAaNWC0+eu2YXs+TSXv7bd1xD4TLUVet04HukOj7fGq6PO rMa3AxwBxuaYiJX15+M15H3DTqkp3tTQAAMefoBdtzUzm8JohgUrzge9cqMmqyo4XAJ6 rCRHAK5jiFkWqwhCOT1htU5HcyS9TQFaGWb7Gb6lzeLPRHStRwVaiZXlPaEu3proWFAE CT2Q== X-Gm-Message-State: ACgBeo2U19GcHkjPXpi/VEU2JaqmTJanEaeonynn7Z8aZw53DDSM1O/f ccnLEgvqSmW6grj28UtAdK1vE8zrktaA/ISyo75xYA2AsnBzcw== X-Received: by 2002:a05:620a:254d:b0:6ab:84b8:25eb with SMTP id s13-20020a05620a254d00b006ab84b825ebmr3270736qko.383.1660851710030; Thu, 18 Aug 2022 12:41:50 -0700 (PDT) MIME-Version: 1.0 References: <1660649244-146842-1-git-send-email-john.garry@huawei.com> <1660649244-146842-3-git-send-email-john.garry@huawei.com> In-Reply-To: <1660649244-146842-3-git-send-email-john.garry@huawei.com> From: Andy Shevchenko Date: Thu, 18 Aug 2022 22:41:13 +0300 Message-ID: Subject: Re: [PATCH PoC 2/3] ACPI: platform: Refactor acpi_create_platform_device() To: John Garry Cc: Len Brown , "Rafael J. Wysocki" , ACPI Devel Maling List , Linux Kernel Mailing List , Linuxarm Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham 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, Aug 16, 2022 at 2:33 PM John Garry wrote: > > There is commonality between acpi_create_platform_device() and > hisi_lpc_acpi_add_child(), in that it covers 2x main steps: > - Read resources for the acpi_device > - Create platform device > > Refactor acpi_create_platform_device() so that it may be reused by > hisi_lpc_acpi_add_child() to reduce duplication. ... > + * acpi_create_platform_device_ops - Create platform device for ACPI device node Not sure I understand why _ops is a suffix for the function. I would expect _ops to be a data struct where the ->xlate() and perhaps other callbacks may be collected. It may be that I have missed that portion in the previous discussion. ... > + if (name) > + pdevinfo.name = name; > + else > + pdevinfo.name = dev_name(&adev->dev); > + pdevinfo.data = data; > + pdevinfo.size_data = size_data; It rather reminds me of platform device registration full with this device info. May be what you need is struct acpi_platfrom_device_info { properties; name; id; ->xlate(); ... }; ? ... > +struct platform_device *acpi_create_platform_device_ops( > + struct acpi_device *adev, > + const char *name, > + const struct property_entry *properties, > + void *data, size_t size_data, > + int (*xlat)(struct acpi_device *adev, > + struct resource *res, > + void *data, size_t size_data), > + int id); ...because this looks a bit too much from the amount of parameters point of view. -- With Best Regards, Andy Shevchenko