Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp894095rdb; Sat, 7 Oct 2023 03:42:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGwIX6U9fJvmDRJbzR9/x2nWE6lsMXgWAt5Y+qvh3L/v9Jsznv3HPYurNebOZ1z9ovmDSKE X-Received: by 2002:a0d:cbd3:0:b0:578:5e60:dcc9 with SMTP id n202-20020a0dcbd3000000b005785e60dcc9mr10348762ywd.10.1696675320046; Sat, 07 Oct 2023 03:42:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696675319; cv=none; d=google.com; s=arc-20160816; b=la7ms+WvWr9MQ1cXkZIEZ1/OSZ2Xttsni4xtqZXfhHfRGt/GQzrB04teCuVGzRbrHT eaSPjs5z5NS1BHVq6pfykwwktR0XTTfWw4NbIXRcmLcWrZI5MJnhwDbE8+777knUJ0uZ d1ELShkv0lT5Yavo8miH4BfqJWVgofY/ZvRWpifgq3HM+1anutqtOdPt5wRZy6psbcyo aUPzoEv4rxFg2EKFKeVGezU+Q3hblxLCA1wvrVpbUA6ynVLT1Ih0sAGXqhbufyEp/6NX 82Fswasn2dRXuC1TsdFslHIVQrtOGPBXJQeLMw8dZ0L3T8UHLru/OLnu/bynaPMGUZHd PlZw== 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=iOMPQmSpHN9UHoRIJALfFhubhG2Yo5LreiGsjUh6+lk=; fh=ohY9KbQrqwdfBnJyhnCftmhx1VPnNhcIFepDLfECDo8=; b=gvRRlDKu35Zv/7f9yxxBKLLiOwbEGiIlZKsYXZINUl3Br/5mjmW6EOPoY7QGYwDlRb +jtecX2jIBVH9wBI7Mj0ZdeV2pXlgEwxA0YFccZRdc3dCxb0/QAlzYTVj5VIoRVV4UJp HCBZOJ6bI/TQckWoNy8UCzAu3B/AbJ1SGmnTKzC/PkmxLbiYdEam6XnhLBfB0uTGnXag /0YZNq7RMy6cBoWKkh9KTwfK+nwYxhmnjraqFHMves6fuuzU2dUGJ0+aiskbzan/A5fh oOQXVmoL7X6Ow+FRPNypSyb4a9b7n058SqVJ7aW65aWrGbEO+dzRMNjprmRNjydpirYa cGog== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id y64-20020a638a43000000b00578bd92e502si5486967pgd.558.2023.10.07.03.41.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Oct 2023 03:41:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id 587828047E7E; Sat, 7 Oct 2023 03:41:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343821AbjJGKls convert rfc822-to-8bit (ORCPT + 99 others); Sat, 7 Oct 2023 06:41:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343824AbjJGKlq (ORCPT ); Sat, 7 Oct 2023 06:41:46 -0400 Received: from mail-oi1-f170.google.com (mail-oi1-f170.google.com [209.85.167.170]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F15193; Sat, 7 Oct 2023 03:41:45 -0700 (PDT) Received: by mail-oi1-f170.google.com with SMTP id 5614622812f47-3af59a017a5so520448b6e.1; Sat, 07 Oct 2023 03:41:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696675304; x=1697280104; 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=yTW/418JZkwu1M4Lrtu4B4aaWXqu9uvEkO2zcTVWixQ=; b=QDGBZ65rhJHQocgEQp1TDLkgJ/bBPXLYLeOtSpzuuSZ8u6n1PaW8L/uxf6D74clgNX mmlpnku7HQkKTWNWhc0wg0NnsADsoQwkAZ/ysTG2AV/rRrAvBTnSS6oHBA1M6jH1nULD GMu6oQiekBFnGgnmHb7nXiE3btC5JYoFuNV23YZI0BkUSHGUW/BCAu10B1crKynozR9x hW2+OMJu2uVJM6QMBCSaMMLMgZkP4OXyuGTLe5+TU/1w/P0Kr1wD9FrpVlbjbpdoYgEV zveZYuD08axZfBgnIVEvO0bSjGGjqPCZlKG/IsFFbRhpAc9WycKr62ohFbqS7rWRVBse k0mQ== X-Gm-Message-State: AOJu0YxCTwj8KbBmTp+dHKxei794qBcHPbXAH936bt/9fzFBw5HpagUP B/RQAePacnPddvd0VGKml2nCMoEMMdBiNXYlHxM= X-Received: by 2002:a05:6808:21a6:b0:3ad:ae0d:f845 with SMTP id be38-20020a05680821a600b003adae0df845mr13923287oib.5.1696675304578; Sat, 07 Oct 2023 03:41:44 -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:41:33 +0200 Message-ID: Subject: Re: [PATCH v2 3/6] ACPI: AC: Replace acpi_driver with platform_driver To: Andy Shevchenko Cc: "Rafael J. Wysocki" , 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=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 fry.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 (fry.vger.email [0.0.0.0]); Sat, 07 Oct 2023 03:41:57 -0700 (PDT) X-Spam-Level: ** 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?