Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp2052532rdb; Mon, 9 Oct 2023 10:51:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFUFtPPfyoq8XgCxEDPX1q0OjJwH5qvcty3lipshgoO52N49ooCIHxCN4+VS7yD9QKAm2e8 X-Received: by 2002:a05:6a20:4292:b0:157:1b5:61ce with SMTP id o18-20020a056a20429200b0015701b561cemr20597527pzj.4.1696873908925; Mon, 09 Oct 2023 10:51:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696873908; cv=none; d=google.com; s=arc-20160816; b=ecjCsFyRnquptzSb9SOZdISEvO1q5USBsKmFHDIF+vQqnpdg43BXnCeVs2JCzy8Boj /H0yL+cwP3zUSvnEvwg9+/9MFpBBtFvry+MCHjrELeEYvVTTrzEAhOwcWjcRFVBYSsZ9 2Aw6xXxs6nFq+tJn0kuKnUr9v/RzXvQs2QOKhJ7hf4uJ/Eziy9NKG2YoK1qKrLvdeSrz aRYFqhEJRH4lfHqS266Cp9jti/onLOEynouWqKwpWdBGenUtkoR+os4S8/zkGorSsTPZ axO6BO0XKzSA8tVD1HdQrH6d8Uu1W6dm9Hw03fEdowMfPWCMEFZvsuidyiXaU1VGyGVL nqjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=7MeRgl98x6WsCmSGpWGRQVHU+w6FBKCNoIdIjqnlcZk=; fh=EhOvddInBVHobvwuJh2BzcCSN6QTiJoasIVRoSVpGtU=; b=Rw1WmKSJBYLRJsRbdGElgkrBVhd//vkkPUfAfYZQkQAqL98jKBfssUZ2H3FM9kzack l3hAdFfxcMd5xU8+aWu7r1CTpHNteIZsAjfJuKu5IwyDGan2S8ZbL1sMWmFeoVcpTP9g 0Bd5m0P+GnhhiyxcceUdZXFwRhv7aCVLJkWevpYMctiN0B0LXWlLms/dzXTcdBuGTrPW KFmYQRNQE2FpM2d1VOS4Br+0Uu/UJ9UlllGw4WpmoNmjN9kbnjC0JAeefpdqkN/LKjXq UXcthmwsQJv5o1di18AJMWBM44b0FKlg7iGgby/bITXIIXhG9RAPHUT8EBetG5sOa1D/ cvGQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id z10-20020a056a00240a00b0068a6f6d9f7dsi8150272pfh.57.2023.10.09.10.51.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 10:51:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 9AD8B80423AB; Mon, 9 Oct 2023 10:51:46 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345624AbjJIRvj convert rfc822-to-8bit (ORCPT + 99 others); Mon, 9 Oct 2023 13:51:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346636AbjJIRvi (ORCPT ); Mon, 9 Oct 2023 13:51:38 -0400 Received: from mail-oo1-f51.google.com (mail-oo1-f51.google.com [209.85.161.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BA7C91; Mon, 9 Oct 2023 10:51:37 -0700 (PDT) Received: by mail-oo1-f51.google.com with SMTP id 006d021491bc7-57c0775d4fcso601809eaf.0; Mon, 09 Oct 2023 10:51:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696873896; x=1697478696; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xQBtcxUEBTteAt95r1bhShJsO6XhiQD8q2TBwfTAy8Y=; b=a27bL+5hUMdadMar1HdOrLQgvXFxc0nCTQXNIwpudT3K+tiDJpqtk2OYpdKlRA7XsN R5ZVLSYodOcYFp/Yx298TpKJvOV6znQ/yzXdDA3YSSthlGBf5v6VRZMbDaBewijbECSM rmCFwGdj6yHuDsvs+lbojVfrRdTkEgBHuNl0J/6VFsBGG6VXW/cjmSht4QldvjCoY2Wp WyxvEbEa5k712Brj5KkJvQ7eWmiGeGAu4FbNzfBdHviKxuz3rhen9UDgwJWlhwWAM20z DjdL263SqP5Y/cjI87PIuChdyQeViSfTfWASjN4wLdd5CKryD7vgzJJurM6Iwh3srZgc LDNA== X-Gm-Message-State: AOJu0YxQ+YcEF+pOO2UZMvRrZCFA7EonA7h+EMB31oMd8urCBA17I2m1 rcOb4FYzPBvvC1teZDb/a15COOcK8GLSYkKtNWw= X-Received: by 2002:a4a:de08:0:b0:56e:94ed:c098 with SMTP id y8-20020a4ade08000000b0056e94edc098mr14198631oot.0.1696873896270; Mon, 09 Oct 2023 10:51:36 -0700 (PDT) MIME-Version: 1.0 References: <20231006173055.2938160-1-michal.wilczynski@intel.com> <20231006173055.2938160-4-michal.wilczynski@intel.com> In-Reply-To: From: "Rafael J. Wysocki" Date: Mon, 9 Oct 2023 19:51:25 +0200 Message-ID: Subject: Re: [PATCH v2 3/6] ACPI: AC: Replace acpi_driver with platform_driver To: "Wilczynski, Michal" Cc: "Rafael J. Wysocki" , Andy Shevchenko , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, nvdimm@lists.linux.dev, rafael.j.wysocki@intel.com, lenb@kernel.org, dan.j.williams@intel.com, vishal.l.verma@intel.com, ira.weiny@intel.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=2.6 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 09 Oct 2023 10:51:46 -0700 (PDT) X-Spam-Level: ** On Mon, Oct 9, 2023 at 3:04 PM Wilczynski, Michal wrote: > > > > On 10/9/2023 2:27 PM, Rafael J. Wysocki wrote: > > On Mon, Oct 9, 2023 at 10:40 AM Wilczynski, Michal > > wrote: > >> [cut] > >> Yeah we could add platform device without removing acpi device, and > >> yes that would introduce data duplication, like Andy noticed. > > But he hasn't answered my question regarding what data duplication he > > meant, exactly. > > > > So what data duplication do you mean? > > So what I meant was that many drivers would find it useful to have > a struct device embedded in their 'private structure', and in that case > there would be a duplication of platform_device and acpi_device as > both pointers would be needed. It all depends on how often each of them is going to be used in the given driver. This particular driver only needs a struct acpi_device pointer if I'm not mistaken. > Mind this if you only have struct device > it's easy to get acpi device, but it's not the case the other way around. > > So for this driver it's just a matter of sticking to convention, There is no convention in this respect and there is always a tradeoff between using more memory and using more CPU time in computing in general, but none of them should be wasted just for the sake of following a convention. > for the others like it would be duplication. So I'm only talking about the driver modified by the patch at hand. > In my version of this patch we managed to avoid this duplication, thanks > to the contextual argument introduced before, but look at this patch: > https://github.com/mwilczy/linux-pm/commit/cc8ef52707341e67a12067d6ead991d56ea017ca > > Author of this patch had to introduce platform_device and acpi_device to the struct ac, so > there was some duplication. That is the case for many drivers to come, so I decided it's better > to change this and have a pattern with keeping only 'struct device'. Well, if the only thing you need from a struct device is its ACPI_COMPANION(), it is better to store a pointer to the latter.