Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2504365lqb; Tue, 28 May 2024 01:43:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUAn858Pip3Js6mdWx5/QrMDcMVXwWg7XTDs3uhz8JLmgyYsvf5TNUwCS7WsO4v3dSfGs40lKjOvIluqYketSTVGrjUKpHSy8PiXTI3bw== X-Google-Smtp-Source: AGHT+IHxYFFwD4WF17VkOTPK9l20MiVlE56JTiM4iBtjJSipMI2Mk8bq3qubZEzGiMwIMEzzwD7x X-Received: by 2002:a17:906:dfc3:b0:a61:54c3:9f8a with SMTP id a640c23a62f3a-a62641aaea4mr792723366b.7.1716885812183; Tue, 28 May 2024 01:43:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716885812; cv=pass; d=google.com; s=arc-20160816; b=rCaZ17bQuGTL0H3r2Jldgk7iG/3HlHaR4He3Y/WNclsJLKzIzRIFSK3wmUWNDL520w LmBEuJTf5qDQc8O0I+oag8m4O2GHP4jRuJK6CXAVUgmVAaSbLfB0hhPZc97jm7GL0Z5N rQ1aZLFPsz3jR6Q0AZkr19qIsY1jRM/WYJzhWNbmcPGr3BZLCgr80KBiRT3HPw82C9sD 8fgO9p58DXNZy4tquYuF7kDr7xayh91j59BjJEPpACONmvIYhXhoeNHY4ogxUGILMaMJ epxXVigXh9gRzKr0g3zZSTzxfU1vF7CHoHOQB0DymGjm8pQcnxb8MU8eIeWtcNK+HdPK nj/Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=BDOzOVJxnG+3KEM1LGz7y97uf9duOTHpiqETF8V1CyI=; fh=KdYTqMlrAWBYXP7GX88Af/TUijhhVT/ZGOSG3ig5Y68=; b=QJX9SV9U5PI68x39579WXckk8xW9CVUB4KafAkxtfY9y+ema3zXxuHWJ4/sMLheiVc 9qSMeJqe/8SfZuISStsQZKcff7ODP2PpJYezWkFSdTvhHid6zAtn6zMHzkI8pDvb46an cEqhZey7JcnlMyfPgnh7de7A6KOJtm7ge/76oNaxOXmnxYgYX0QP1pkoBxyi+/rDYyL9 GV+CKu2gqd/tlIVrfW1P967oyyvsMoGT5eEVKkZ8G8x9OvhdfuY20IK1LZuKARoo2uYT mrAD4V7bqN/XUZM1FiXaYjEr74dfwg1uW29PdjWJp3ZdaEF1K6REN2NdudRHmoQ4/ELm MS8A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=google header.b="Sa/sbfRd"; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel+bounces-191955-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191955-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a62c72947d5si306018566b.468.2024.05.28.01.43.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 01:43:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-191955-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=google header.b="Sa/sbfRd"; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel+bounces-191955-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191955-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E1A541F20FD0 for ; Tue, 28 May 2024 08:43:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AB82213C67D; Tue, 28 May 2024 08:43:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="Sa/sbfRd" Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B38D813D255 for ; Tue, 28 May 2024 08:43:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716885783; cv=none; b=aPOSoHAuoPwIG8/k6uJPP6n/NZrkJYF0S85t3IoQlHD7ztWeOPcTzDaw40tcLLK/43LFofko+feWPdYnXyRSUT+XIp0zFVTbpJYFAcxBaXNUWqu8a39/quZ95Yj22ku9nRaH4EVCYTB+GAyZWoTtYwHVsRlZVhW62rQMQvi20Sg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716885783; c=relaxed/simple; bh=Y6f9O1rB7bAdaik8Ya5stBAwGWAwYs7mHE+WNyPAEOo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=fLh5mLsTGXJQgfSWIU42nzpGaSzBwilJtVbKkEwYKeI/d7zucb/tAh5GOCBqZuCyIUVZSRjvbvHxHpZnXURqkqCHzUssrAfZdSaapa336oKJuOboV8CKJ+Y9jpmiGHwfEid9UccBNTMxxKgCVEy2PSTox2VDEcfWYr9jZov63I0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=Sa/sbfRd; arc=none smtp.client-ip=209.85.208.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-578972defb3so645144a12.2 for ; Tue, 28 May 2024 01:43:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1716885780; x=1717490580; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=BDOzOVJxnG+3KEM1LGz7y97uf9duOTHpiqETF8V1CyI=; b=Sa/sbfRdKnz8/QMS+xeYM3nSHA4bJisg2W0l25IlBxTxty4NiXGvKntownbMHodJzp tITa4FnuRTwj/iW57gW2YpY1FtzaZsh2cZBy3u7j9+1DoH0do0vzwd5zeh28ty/BYNd1 wq7I7CvDy/HpeR5LSdeCPZF1OIwueGV55tCuYXt76fGjPc5a3kVlIr7C48gVI67C3K+W oVsUUdRPpTdKUw1u9NXqw5pPv3JoMavC98Sr0y8XLJpcaNUDcB5XhJeDBu0b1aCHl5Pc 7smTUTEtiJbRY9fdWSEjbWUT2ob75jgy8fKva8xkFqI7/zUnZ+S/SJV3q/jTt3CVKkuX F+vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716885780; x=1717490580; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=BDOzOVJxnG+3KEM1LGz7y97uf9duOTHpiqETF8V1CyI=; b=YjTwvWAJ6xjsy1OOXBcWihvz5qt7x4NB7OW75C7s04C7N36smN8mTBsD8edXlkezxL 5phlKWO6sVKlwbqiLSpyhP1HCEON+WWahQH/oSwLzOZ8WSVLVSuhoWuklDAoSl5NOnkH YOGXUAmztfieBzPMGXMuzmNHXtt57OoZcRlMtRniByuTffH9+6881efpSazg7L/9rwuY 7Wj23tN7LdqtJhbjvDNzJRTFTOz1oI9PlnYke1sQxCKgAp67woqHoppPIvXCgWr3rgQL iyJE7JU1zuXYxCQEkxdWgaWEu5oSNOkJQdHZPsrEsJHjUBpsM096VuV2mY+kw5T6Mjac cU4w== X-Forwarded-Encrypted: i=1; AJvYcCV/TBmvsrzAC9zlV3cYpftwZlnv0EJXrU6ivbopB3MAQpAdv7oeQKP8674jvJpC+AECAxHNMut3p5vdiI8Jn31ET4RFizz6EVj54xV5 X-Gm-Message-State: AOJu0Yy1RUMP5+mZmgWg1w+rDu24Q44P36bbazSyb1B6VNRKftnTKptO a6a3zzvcoGmwl0/xW3d2n1NGkTl49wHDzcWqcRespi/sGM71NHk0TbfHR2/KycM= X-Received: by 2002:a17:906:69d0:b0:a59:9c4d:da3c with SMTP id a640c23a62f3a-a62643ec91cmr716821266b.40.1716885780045; Tue, 28 May 2024 01:43:00 -0700 (PDT) Received: from ?IPV6:2001:a61:139b:bf01:e8eb:4d8f:8770:df82? ([2001:a61:139b:bf01:e8eb:4d8f:8770:df82]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626c8170cbsm585860666b.20.2024.05.28.01.42.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 28 May 2024 01:42:59 -0700 (PDT) Message-ID: <9a0073a0-d598-4c1a-bb32-328d0a279152@suse.com> Date: Tue, 28 May 2024 10:42:58 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 4/6] power: supply: lenovo_yoga_c630_battery: add Lenovo C630 driver To: Dmitry Baryshkov , Oliver Neukum Cc: Sebastian Reichel , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Hans de Goede , =?UTF-8?Q?Ilpo_J=C3=A4rvinen?= , Bryan O'Donoghue , Heikki Krogerus , Greg Kroah-Hartman , Konrad Dybcio , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org, Nikita Travkin References: <20240527-yoga-ec-driver-v3-0-327a9851dad5@linaro.org> <20240527-yoga-ec-driver-v3-4-327a9851dad5@linaro.org> Content-Language: en-US From: Oliver Neukum In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 28.05.24 01:15, Dmitry Baryshkov wrote: > On Mon, May 27, 2024 at 02:26:36PM +0200, Oliver Neukum wrote: >> On 27.05.24 12:03, Dmitry Baryshkov wrote: Hi, >>> +struct yoga_c630_psy { >>> + struct yoga_c630_ec *ec; >>> + struct device *dev; >>> + struct device_node *of_node; >>> + struct notifier_block nb; >>> + struct mutex lock; >>> + >>> + struct power_supply *adp_psy; >>> + struct power_supply *bat_psy; >>> + >>> + unsigned long last_status_update; >>> + >>> + bool adapter_online; >>> + >>> + bool unit_mA; >>> + >>> + unsigned int scale; >> >> why do you store unit_mA and scale? This looks redundant and like a source >> of confusion to me. > > Here we just followed the AML code in ACPI tables. The unit_mA is a > returned from the_BIX method, the 'scale' is used internally in the DSDT. > If you think that it's better, I can change all '* scale * 1000' to > 'if unit_mA then foo = bar * 10000 else foo = bar * 1000'. I think that would indeed be better. Implementation details of the DSDT should not dictate data structures in a kernel driver. Regards Oliver