Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp894634rdb; Sat, 7 Oct 2023 03:43:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG9+kyQfgPEBgP7+u/YM3PnublmMvU36JmKvkXpR7phNb3hdiz2wtDdjvUdAYYo0I/urRGM X-Received: by 2002:a05:6808:1391:b0:3ab:85a1:fb04 with SMTP id c17-20020a056808139100b003ab85a1fb04mr13925817oiw.9.1696675407467; Sat, 07 Oct 2023 03:43:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696675407; cv=none; d=google.com; s=arc-20160816; b=uNfqIbIayN/AjjWL6Ojn1X68iSQ8QLNnsDrsaIQQnkmqHyIGnO5vO058zulaccTu4i PbPGqqODJZLDaCiCcSpfJUEUHDeSnQWGXe0DgzV0xjy5SsetM15pOFoJCanSaCfxi68V B7TBLsFVTQBzcafRHsYEEW4cJ++LNDjLdAqS08JVTlqJx80zDbsVM1OlMMemvORKG2ZG wEt/YyiBCCVhyy2kCAoi6B1NJgJxE3DHybryvjMt0Tld/DraOoiKEogNYo469lRbuOET eO78andY/7Gbwug2wDG2A8hMuSE2vzdLMzBJrHyitv3IB/pj3YHna+TZwHrSe+mHwgJf UZJw== 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=hsuDmNnsMZNxbJzdJlII87EhGwKRgODnIfRlxv7vwhY=; fh=VdlAFINsJAvRqZ9dSQAk+ALF6D/0szX0qD+XkmliwMY=; b=bfBqXnabKzS1p5VQftC0cKJGW9gijfv6NrTTXuBQBiES6iDCtbuMrOktcuob0je9Dr mP+NZtrL6VDR1dwpoRcuVw9xQVK20yuucQQbTyhVNkvu6naCwPsZNFesl7AljpYmAEGt q7CEH02rlEH5tkdYYnqLS0f+ou5rRcggboIMFLa8JCJ5W6TZXHJWMjBylXZDY7oNfUcy +7cXTZywz65AQFSLwMTikMJkZg4y5IKX2kob90VYcTnRp240Dj1fkJ3H4h6F9dANAl1J uS7YgPJn0izv2zNNpInCUgKVEHhZYePIsISKfHGsLYS74dU5FjbEs/B2TGv1Vg9Mdlpy yF+A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id i125-20020a639d83000000b0055fd1bfacafsi5483983pgd.755.2023.10.07.03.43.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Oct 2023 03:43:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 4CCFD804ACC7; Sat, 7 Oct 2023 03:43:26 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343828AbjJGKnY convert rfc822-to-8bit (ORCPT + 99 others); Sat, 7 Oct 2023 06:43:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343817AbjJGKnW (ORCPT ); Sat, 7 Oct 2023 06:43:22 -0400 Received: from mail-oi1-f171.google.com (mail-oi1-f171.google.com [209.85.167.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C98F692; Sat, 7 Oct 2023 03:43:19 -0700 (PDT) Received: by mail-oi1-f171.google.com with SMTP id 5614622812f47-3ae473c0bd6so519193b6e.0; Sat, 07 Oct 2023 03:43:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696675399; x=1697280199; 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=KI+7EOVOyPWCiOOc7dvfxOKmEPx6gMqHAT3wBewOPrU=; b=CZI338f1HDEFFafiz5qjR7BeSR4m8uJbnPShA1LRCIV+shGic6t/7bnrtlDwFHdySj 4FRmmgzrdc446sSqukw9sx+veRLQBWm5urJqxHnLtKbSWf36ONTdz+G2Xi/CpoH6VY4q 9XxdHtlYk413j0nt2qDW/KJvnN+8cE8fYCy+l5kHEEbL3Ny4PMWHTeaGbGQQOyXlApFc mEni6B/homN7wNmp6dVrxUwfO5PcXeeXEBtKaMfzHP5RPXm+01cHxCbXNAGgwosvftws U9YwGliseTm39ee2kxT9Di8D+ClssgfbPpryOh928ryCHgZsiwIBJICvuPP97oEjRimG lT9Q== X-Gm-Message-State: AOJu0YxLnVunWOj3tCZNSSG0jILOgD+SY8yEgNCUpzLRZpRNwXT65nfN P8ND1GcceF9djWRkPhMU/sMx4oWsYJxiEWYlsGM= X-Received: by 2002:a05:6820:390:b0:57c:6e35:251e with SMTP id r16-20020a056820039000b0057c6e35251emr10038284ooj.1.1696675399094; Sat, 07 Oct 2023 03:43:19 -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: Sat, 7 Oct 2023 12:43:08 +0200 Message-ID: Subject: Re: [PATCH v2 3/6] ACPI: AC: Replace acpi_driver with platform_driver To: Andy Shevchenko Cc: Michal Wilczynski , 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=-1.8 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,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 lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Sat, 07 Oct 2023 03:43:26 -0700 (PDT) On Sat, Oct 7, 2023 at 12:41 PM Rafael J. Wysocki wrote: > > On Sat, Oct 7, 2023 at 9:56 AM Andy Shevchenko > wrote: > > > > On Fri, Oct 06, 2023 at 09:47:57PM +0200, Rafael J. Wysocki wrote: > > > On Fri, Oct 6, 2023 at 8:33 PM Michal Wilczynski > > > wrote: > > > > ... > > > > > > struct acpi_ac { > > > > struct power_supply *charger; > > > > struct power_supply_desc charger_desc; > > > > - struct acpi_device *device; > > > > + struct device *dev; > > > > > > I'm not convinced about this change. > > > > > > If I'm not mistaken, you only use the dev pointer above to get the > > > ACPI_COMPANION() of it, but the latter is already found in _probe(), > > > so it can be stored in struct acpi_ac for later use and then the dev > > > pointer in there will not be necessary any more. > > > > > > That will save you a bunch of ACPI_HANDLE() evaluations and there's > > > nothing wrong with using ac->device->handle. The patch will then > > > become almost trivial AFAICS and if you really need to get from ac to > > > the underlying platform device, a pointer to it can be added to struct > > > acpi_ac without removing the ACPI device pointer from it. > > > > The idea behind is to eliminate data duplication. > > What data duplication exactly do you mean? > > struct acpi_device *device is replaced with struct device *dev which > is the same size. The latter is then used to obtain a struct > acpi_device pointer. Why is it better to do this than to store the > struct acpi_device itself? This should be "store the struct acpi_device pointer itself", sorry.