Received: by 2002:a05:7208:3228:b0:82:47:81bb with SMTP id cb40csp2639855rbb; Tue, 16 Apr 2024 07:32:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXgwn/gJik1+9LLa8Zj5lvWNlY4kXKnwU5g9dJOx+bznVxoSoBIaTdd1GUTrNbFFJrwwhO+LayxlGqj33oOxBe2igLaDmKHSPuN5MocNA== X-Google-Smtp-Source: AGHT+IGPVTnLQ6PsYtNekaLxkFswenRR3tBRZ1Qfww9BkKtnOsMdWwRbKV9P9tIIs8EohEU/PHsd X-Received: by 2002:a05:620a:1daa:b0:78e:d220:9d38 with SMTP id pj42-20020a05620a1daa00b0078ed2209d38mr9987804qkn.54.1713277945324; Tue, 16 Apr 2024 07:32:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713277945; cv=pass; d=google.com; s=arc-20160816; b=G10L1e3GH1ERQ0lidBWxVe3JZ8Bt+4A6cVyNlOO1LYk9AYy2ZfeIqSA3fh7ejddB2U nC1qGdxz3tY3aUBswggcrhwMWDabE6lFg1xDi2DBT587fLkesBwySy3656JyQwa1CJXJ mJrhIzOErwKd/X2AIBPtHkiV7fT+1yZmLNlvGuKgcNZ+PSwjVXHJQvCmmzcWswhb1IcN 4CGrz9DwMq8jsMYS8guUFuoIJ4d3IfEzP/FTy6LKgdl9N/04WpDonAIUqKmnD3JpJS/3 dkQvQPSh4otaAL8C74Tqh4MjKWSYeOrB6T1fkiZjIC6UZdI/LhOhsdVa5UiDQmHUJiPH b1uQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=mEL87yU2GeUFgtin2uL346H/319s0UTCg39CXJm2FuA=; fh=eep2eH82ndO9fbFNrtf/095aHFu1QLZk6mMYXh2YmkE=; b=PZYeahDpnSu2oO6zuUf3fjpEA1AoqHImdm7hTVwswoBEqK55NdhrYcarJdiSFtEOxc 1zp0CjKKoy0L/pWgEkIvkN8EvJQOjxBbigql0u8RDTeh8hxXsxYyUC1+Eq5tX3mTxdv8 yAq5IYAAndmfb/Sf2kBzLbjEZVivENbNomrFCNU4QJmaYs10u8XZOEayR0VulEo4P+ZM cjL50TB0w7o+1k7wb2uY8rrl73IEsAkLaMl9kSOhRWCAkfd/exPc5Q+KyHyfozHhif5+ QysVIuK7ME8e86j5yKdNF63uQLLGXoUmFQUYT3tJ+uJEb1I8gztQJsHTeS+pHDmrZh+v BAow==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=CRyCJdk9; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-147020-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-147020-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id i25-20020a05620a145900b0078d6cc21128si12430718qkl.618.2024.04.16.07.32.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 07:32:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-147020-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=CRyCJdk9; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-147020-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-147020-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 0D3111C22802 for ; Tue, 16 Apr 2024 14:32:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A5799839E0; Tue, 16 Apr 2024 14:32:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="CRyCJdk9" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6716B1CAA6; Tue, 16 Apr 2024 14:32:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713277936; cv=none; b=XbiRmG/hWkHFxRD7z/dyGcIsRtCfAkWKasDda9Kdwm1QG4xW/lG/fzAXT3sFmTc6OXr1Z40YJ9UQzr1y+zsD8E7oliAquQwXJMaAYrToRm6TuE8ZZ6dtVMtPFKrOt6IXkSP7o4e2i3M0Uo+rhdJwL5BSy6iFmWg7ZGsFFNITPXA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713277936; c=relaxed/simple; bh=xwtOX3huVgNQWdzLmjX+ow6uv3bTrZuFvMHF8dtE9a4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=mQOZMRfrqZyiI7U1v1kI/LI03UE/NngahIGrfgfwHle30Xe9c+dsA7AgRNpYanYrwgyqKWj+WPOoB27ZzZkd/Md+zEbiv9QPm8MVOYIVpJA0mK8oQvWVALFZgdlqrQbsY4icz37x0ZwvxIxVXU4RomWnizZD6Vq5KBb2MvXK7bM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=CRyCJdk9; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1713277933; bh=xwtOX3huVgNQWdzLmjX+ow6uv3bTrZuFvMHF8dtE9a4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CRyCJdk9BPM0d4kzXLOxXz4EylR0wqZhxNbJR89AC3uCDb+7PEoZ1pPCcQJx25jvv Y2xbXdD9hj6+yPwoulIB5puWXkEf21/Ba8OUxyvR1D4MoQ7Dy1ykkmLitxLXJ5IT0M 4VOz6S+m74p/WqkxE45AX5HPwEYY32SePcmYjfHnm7Ce43lB6zI8pWwksZNl18SWQ3 XwfqRnj/OzxJZpKmwEo3RtDoZRaoKV75oiN5BEAemk4n45cftF8PPO3QJxrWl5nlyf zCRAGkMR/9TUPCrcEJBCbeDQ7jXs24jTw9XtgqWHlssOyY4vQUSiaBqfaPPFrZQyg7 wt8X90IFgqitw== Received: from notapiano (zone.collabora.co.uk [167.235.23.81]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: nfraprado) by madrid.collaboradmins.com (Postfix) with ESMTPSA id B6BCE37820F9; Tue, 16 Apr 2024 14:32:12 +0000 (UTC) Date: Tue, 16 Apr 2024 10:32:10 -0400 From: =?utf-8?B?TsOtY29sYXMgRi4gUi4gQS4=?= Prado To: AngeloGioacchino Del Regno Cc: Sebastian Reichel , kernel@collabora.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] power: supply: sbs-battery: Handle unsupported PROP_TIME_TO_EMPTY_NOW Message-ID: <9f805ec3-1611-4682-831e-9499ba8284d5@notapiano> References: <20240415-sbs-time-empty-now-error-v2-1-32d8a747e308@collabora.com> <9ba1b4df-78dc-4f24-bb61-d7b168da18f8@collabora.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <9ba1b4df-78dc-4f24-bb61-d7b168da18f8@collabora.com> On Tue, Apr 16, 2024 at 09:46:56AM +0200, AngeloGioacchino Del Regno wrote: > Il 15/04/24 21:05, N?colas F. R. A. Prado ha scritto: [..] > > + > > +static void sbs_update_quirks(struct sbs_info *chip) > > +{ > > + const char *model; > > + const char *manufacturer; > > + unsigned int i = 0; > > Please reorder: > > const char *manufacturer; > const char *model; > unsigned int i; > > ...and please remove (like shown, of course) the double initialization of the > `i` variable, as you're initializing it again later in your for loop. Ack. > > > + > > + /* reset quirks from battery before the hot-plug event */ > > + chip->quirks = 0; > > + > > + manufacturer = sbs_get_constant_string(chip, POWER_SUPPLY_PROP_MANUFACTURER); > > + model = sbs_get_constant_string(chip, POWER_SUPPLY_PROP_MODEL_NAME); > > + if (IS_ERR(manufacturer) || IS_ERR(model)) { > > + dev_warn(&chip->client->dev, "Couldn't read manufacturer and model to set quirks\n"); > > + return; > > + } > > + > > + for (i = 0; i < ARRAY_SIZE(sbs_quirks); i++) { > > + if (strcmp(manufacturer, sbs_quirks[i].manufacturer)) > > + continue; > > + if (strcmp(model, sbs_quirks[i].model)) > > + continue; > > + chip->quirks |= sbs_quirks[i].flags; > > + } > > + > > + if (chip->quirks & SBS_QUIRK_BROKEN_TTE_NOW) > > + dev_info(&chip->client->dev, "Added quirk disabling TIME_TO_EMPTY_NOW\n"); > > I don't really expect many quirks, but having a dev_info() print for every > quirk that gets set would make this driver too chatty, IMO. > > Please, either turn that into a dev_dbg() or print a mask of the quirks .. or both. I wouldn't make this debug as it's pretty important information to be reported. I'd be ok with having a single message listing all the quirks, but at the same time I feel like this would be trying to fix a problem that we don't know will ever exist (one SBS battery that has many quirks). I propose we keep it the way it is - a nice clear message of what has happened - and adapt in the future if it turns out to be too much information. Thanks, N?colas