Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2514141lqb; Tue, 28 May 2024 02:08:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWzkf/MDKoRJCHUAJlD04RGsGzujAQpwO+pOkHhrWzVgvgyOVX9ZBvX07e47mnqJIhGP7GGgQb/mfeiklxgELce1yII4VC6QOf/S69jsA== X-Google-Smtp-Source: AGHT+IE4ufsWXNGHAmm+DyEMCVFsDCOeqqlKpiRAMN3TpdxuLlbpHJjTbFKi6+EClLMFE/+Tio8O X-Received: by 2002:a17:90a:c90b:b0:2bd:e32d:e6b6 with SMTP id 98e67ed59e1d1-2bf5e944b2bmr10241089a91.2.1716887317399; Tue, 28 May 2024 02:08:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716887317; cv=pass; d=google.com; s=arc-20160816; b=wkzJ+y9h53A0pyXRSMoN2wYqAOys5afn0uDW6dyUmlRUVTkaaY+fAfUTrbC+911L6G 5xI7vWEdFIVWzshKWIothsEQ/SA4PZGElBl2qw1d2untJ73l4GPcyL15UeroikyCaBe+ +u0OFzOj/cF8dZYqBJJW0LFu7mE10veXcTNHda2C51rbmz+yC9srolGDlNawz0Pxoq+P TcCKJrms8F4LycoFrLdBbAxtpqJHtmaFbnyxS5+G4dzITyjxqOdobLN3NzCg3OkyfFqn q/qryhQI0NvN0JJ4T+MHtHp0XyVWCKhAr3Sw707LNDWPRrGfiKAF4G0cRXiy2k9h6HlH EA4g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=qco2VkcgOsBroVWxxvK7SBMAfuOUTvOxLPV6N/M2lx4=; fh=S+ffKXAcCh1w+qXcJWI7oz35We5VxHLQ8kUbFK+nxow=; b=grBBz6DXT7nWKNo7EudzdIWONk3xF3dc37gpxOhlQS0jdqHjp9TS2/S/I1u+gkFDbh Ywn5m1g6F7DnktSL9YsjME/77u3eOwO7XJ1s/l2Z2QjKByN2jJK7zjqXHLXf83fN9gSw DzboKr0C5r1UocOR0MyFjJL+2QmX8fEF/G8yXT7FVOtOeAA9WYNmyvNfJKI4vnrxlTG7 9/19tGMLnGuGIrPdm3unIHx9xTtFVAivKqxz6qbdvlr5Oz8iXGBplqzvpWHd0JZK0PtL JWIC9dekT1R22ewrg+KT94i3hiaLj3A6UDHsua8Eoo79BOatvxusV7PWbKY3GkiDq2c4 v+LA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="C/90mX33"; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-191983-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191983-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2bf5fe83256si7701470a91.168.2024.05.28.02.08.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 02:08:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-191983-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="C/90mX33"; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-191983-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191983-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id C03A0B24272 for ; Tue, 28 May 2024 09:05:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1F65113D8A1; Tue, 28 May 2024 09:05:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="C/90mX33" Received: from mail-yb1-f181.google.com (mail-yb1-f181.google.com [209.85.219.181]) (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 C8D6A13D265 for ; Tue, 28 May 2024 09:05:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716887105; cv=none; b=RP9lUypIjI3+ufKCi1MAB4FiNURTCQb1KnAd5rHFUKSh6B1mTuw5fIe4IWVHFryfU8lYAw5a1KGhB/xqchBwqrgMDePdEQmsE07otDGi4jyh/0pVyHIjn+oIKVM9VjgqL6Kh0CmrhsN06I0ugx0LFoc6MAF/nZ8ULOkdjxoIT8c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716887105; c=relaxed/simple; bh=ou2nPJXswciglO/60bjGMxpgyoL9GXfxVJshaAaHVbs=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Uctqt02C1n8jf7/IdzQynVKDPLcXjeSAqgOnSPm02WCyWaxlo+MmEtkV+FjDI2eOki8PsV6ZMdWM8MajAFeqAFRZfgf75iJSN2ukACgP5c6zlbe9PWhf8JnCfXxVmTDIsMpvbFT4yhnq6wPS26FiK5aIacdDWPUsVo/zAPmPXVM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=C/90mX33; arc=none smtp.client-ip=209.85.219.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-yb1-f181.google.com with SMTP id 3f1490d57ef6-df771db8b24so545167276.3 for ; Tue, 28 May 2024 02:05:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716887103; x=1717491903; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=qco2VkcgOsBroVWxxvK7SBMAfuOUTvOxLPV6N/M2lx4=; b=C/90mX33fUnQYrzOzJriV4r3l0Ea/psh8Sl9p4y7uHgpkdmXEE8bJeof7aHWidAteo qhYGLArSc1hYAEdE8PA14IFWg57a1pkKFmJ7i1OIGvrO/77o+oqrngaOhA8clqY6p8eP +YKrdLPpafOj24Xbg4E6x68k9cFRNC/jwwjk/C3yaR618xbhcMLKNdjQIwC6snrcfej2 ZUupgG5+jYxjhPAt12ThhAWW9+PkKu9QOWTLWHdeOGK/bhtnCMhOAu5e10UVnJrBW2Dv yt+RixtJ+McW0KfoD96P/tRJiorGB1xIrNgd44pPIPiJuvSTDTactk3woKLk4xeG0CA6 3M0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716887103; x=1717491903; h=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=qco2VkcgOsBroVWxxvK7SBMAfuOUTvOxLPV6N/M2lx4=; b=X6NR2qgjGSesUO4X55LtNJb0pCpcWpfkdBll5dHnUVcpb76pVc6OEinsYQA8W8xG2t I9719twMk586Rvw79Tc8rS0ukO6MLPA/Gr7n0UEznY6lrSmhg05MRRTDqedwXPf8jjX4 xGmF9XgGOu/ry9hzQgHiINxXli1OC5+KIU5ntPPuaYk9D+yw/V2NjyPnZqn5gE3W61Kf Rj4v3U6uxaDLulpRN0tnHvYt7VPP/JeM271lN77msZ/k1YkyOdaG7Np97DMfg7wGb7WX ZRmwpxSwYSIo0oLZdrV5Xd2rD0YTERegiu0NO+DPvi1HWx1YDFRcLZkvdTryPQ/w2fa6 TVpg== X-Forwarded-Encrypted: i=1; AJvYcCWq68k3prTfokw3ezMGITU7krV4zWII0ZhFcUgBojKqEwYF/6dhZAbyAMpLUiaCNs/ZuiGLbbya1o0RnYdf4LCGLfRuF2+MpC62VzrF X-Gm-Message-State: AOJu0YzHMgeAb+aNHtMnNz02PDT4WJtT7EDzJSvJyFEidMDtJarYDO8O cPKvZTaQ6NNoPVNRkcRAe4hTnWpMESpWsyK00yao/G04ty+e7RVxXpDe7wTySHJ/25Kz5YJDyJf NSS4BtK0PkSOvGuKxVtAC8+kxP8V2QfUId9fV5Q== X-Received: by 2002:a25:908:0:b0:df7:8fdd:1ca9 with SMTP id 3f1490d57ef6-df78fdd289amr7264958276.1.1716887101840; Tue, 28 May 2024 02:05:01 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240527-yoga-ec-driver-v3-0-327a9851dad5@linaro.org> <20240527-yoga-ec-driver-v3-4-327a9851dad5@linaro.org> <9a0073a0-d598-4c1a-bb32-328d0a279152@suse.com> In-Reply-To: <9a0073a0-d598-4c1a-bb32-328d0a279152@suse.com> From: Dmitry Baryshkov Date: Tue, 28 May 2024 12:04:50 +0300 Message-ID: Subject: Re: [PATCH v3 4/6] power: supply: lenovo_yoga_c630_battery: add Lenovo C630 driver To: 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 Content-Type: text/plain; charset="UTF-8" On Tue, 28 May 2024 at 11:43, Oliver Neukum wrote: > > 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. Ack. > > Regards > Oliver > -- With best wishes Dmitry