From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (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 667F125B0A0 for ; Sun, 21 Jun 2026 13:32:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782048768; cv=none; b=YGgyw7lDHCeVMm3cLZgCstraE6/fvql9loC3dTI+tNq5aSFg1c1Tom/J1GesV970e7AKrn8c/oDCTIlkG3WKRTwYO9ZwJ17jL4dAFG9b4KRbLQtIGWOYTzFcl1S0mDil6o435Kwb+9JGEq6AtSWuXhqhoQeWaL/xXC+kTltbtkA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782048768; c=relaxed/simple; bh=bmpEv7zfbPfF+uUXBjGarKYDsIp+jU6IJzmySaHtp1s=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=NSk/iDm/AcOEzfTjN5Z1pPJ1claXZN6wehyomZ/ECUE+4A/vEvPaYzkyGW+KGLCZbfbdfxyK5GyfSDae5OX10TnDwr1YqGyNoIWrfGVuBwoEGgUWUUYa57ku368i7a8rO0fJyVi78LmNWfsKxj0p0N1n8nnE/rZVGj44uk1+NXQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=U7hJwIA+; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="U7hJwIA+" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-490cf322ed0so26014135e9.1 for ; Sun, 21 Jun 2026 06:32:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782048766; x=1782653566; 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=pIUZAKR1TIZbz1tlwg21diURa8ijNKXwIp01TVZOLCI=; b=U7hJwIA+Tv/cWdVBwcbIg9baSUgTSpltZlnBnpPDyXMZnyDASYZc/wqmGHILJ8jcJs CUNfqXNsp56otajgm/vGpAuM4b2Rqc62GIaHHvkf7wcsaF6ddZxEhZoYj/xKBVk8PRYF dwFBf0Dj1SrJsJ2b/vgauZjIWmFHX86mhqMT9S3rvL/e9r5SARXj84cdus41LSQx92Os hGWGV6J9B4hsuvbCnbHcFkUr3tXRBPdmvB/pePUp9iPO8WZXvoNWo/4c9mxY1F/V++B+ huKpffbDKYSy+sQMX80N+2b/vXlZYa3OPnnI0MfP/i8X0IbnfhsqN4gN/XrDQPSXWqSU wMKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782048766; x=1782653566; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=pIUZAKR1TIZbz1tlwg21diURa8ijNKXwIp01TVZOLCI=; b=mCSYzDJJO5p6+/zqAO5/I62f8UwwD/tTTp7d6dCaZ+sa7dqrIsxrsbOToHXv2Getvt +9Zonvykdpf+Ja+qlRldoMt9+czCJYyOPS3aWahMY1jfOE6srD91CeJ68VMKLRImmx+B yEUib0VhA5xQhHFLGKkHSYbPiCMc1ohkrhsOUOJAUHpD/4mxzHJgKAvz4/vnRjkfuu/G j/RP4HUQzmiaKL4YT85mLncckZREUNR/UtuJYNC1ao3yT6qFtp3v5jQ4XxhRkGop71Nk CdJS65q8QpXTl+Nhqryi8fdjhFc0kfbYDlnB/lbwTys87bpuSTEI/47B/dGFb8v1m/F9 aIew== X-Forwarded-Encrypted: i=1; AFNElJ/81OjLZuIeJOvBbhCxANlRQARvUN/t3hrZMrX3FBGuy+wGHoZFXJVCSS4ami4Z63rlfhFzRUuu+lOVNbc=@vger.kernel.org X-Gm-Message-State: AOJu0YwfDkfiYQr7/QwDz4SgFdoKL8Dor7d9mLW7iUg4fYORk5VjoshG f0GJm/n80NCeZlrRL5kZfSNhy4k2ggqbixUHMUXv7u4V3wMy9VOykNrD X-Gm-Gg: AfdE7clveQVu+2Qn8M9f1ZOqz9EQi7M8JD8xW7iOkH9dlmz9U+oBI+kRGuVDnHcoklC btj4hPqY3dUcvZxmIGl7QkLJ2Yjv1qNcaKOc458NqexNo1Q0CsR6i64UyAqGHUWKOk3Z8xmEnOe TTkEX5n/Kc3lf4UoUdJa7UnS32yCaz3612Mscco0SeyC2fUXdRG8/2j5GkL276+NJFL36qypSDp aAvwxlA5hhsBwkwI2OJIia4idyNO7CNeh9ZOw8aIGzb88W1AQB0tYCPiwgiK3dTcnRnRfdvJGl6 LfB5BR78hQFmFdse7E3A5bfO8/j9bSYiyXOdvxtnSxYyHF00pOhELl5NV0iSJrcJn1teBqQK6cJ 0Q+3ioALL9ewh6exPncFDzrSgHbhjuhAfpJrBpgR9tzj7eoCqtaQF+3YajogqhbQ466JgtHMVaw N7rD4rioHx6yN3zHClIeRnsMo4yaw9wggyCyVPZPTumybLopSo5PyjyM2aYM5YYGw5w54RZqK41 PNirQciofq9ft6Vc6FOTsjsgQ== X-Received: by 2002:a05:600d:6451:20b0:492:3fb1:e9b8 with SMTP id 5b1f17b1804b1-4923fb1f003mr130057065e9.12.1782048765798; Sun, 21 Jun 2026 06:32:45 -0700 (PDT) Received: from [10.77.100.5] (ipservice-092-209-213-109.092.209.pools.vodafone-ip.de. [92.209.213.109]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4666712cceesm16955817f8f.35.2026.06.21.06.32.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 21 Jun 2026 06:32:45 -0700 (PDT) Message-ID: <19647fe8-c520-4160-bf74-d398c6b642b4@gmail.com> Date: Sun, 21 Jun 2026 15:32:45 +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 v1] power: supply: surface_{battery,charger}: Consistently define ssam_device_ids using named initializers To: =?UTF-8?Q?Uwe_Kleine-K=C3=B6nig_=28The_Capable_Hub=29?= , Sebastian Reichel Cc: linux-pm@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org References: Content-Language: en-US From: Maximilian Luz In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Am 15.06.2026 um 14:51 schrieb Uwe Kleine-König (The Capable Hub): > The .driver_data member of the the two struct ssam_device_id arrays were > initialized by list expressions. This isn't easily readable if you don't > work with the Surface System Aggregator core regularily. Using named > initializers is more explicit and thus easier to parse and also more > robust to changes of the struct definition. This robustness is relevant > for a planned change to struct ssam_device_id replacing .driver_data > by an anonymous union. > > While touching these arrays, also drop the comma after the list > terminators. > > This change doesn't introduce changes to the compiled ssam_device_id > arrays. > > Signed-off-by: Uwe Kleine-König (The Capable Hub) > --- > Hello, > > the mentioned change to ssam_device_id is similar to > https://lore.kernel.org/all/cover.1779878004.git.u.kleine-koenig@baylibre.com/. > > That allows to get rid of the casts in these two drivers and thus > benefits a bit more of the (admittedly weak) type safety of C. As in the prior patch: I assume that will be a separate change or am I missing something in this patch? > But IMHO the improved readability alone also justifies this change. > > Best regards > Uwe Looks good to me. Reviewed-by: Maximilian Luz > > drivers/power/supply/surface_battery.c | 11 ++++++++--- > drivers/power/supply/surface_charger.c | 7 +++++-- > 2 files changed, 13 insertions(+), 5 deletions(-) > > diff --git a/drivers/power/supply/surface_battery.c b/drivers/power/supply/surface_battery.c > index c759add4df49..1273b6082311 100644 > --- a/drivers/power/supply/surface_battery.c > +++ b/drivers/power/supply/surface_battery.c > @@ -852,9 +852,14 @@ static const struct spwr_psy_properties spwr_psy_props_bat2_sb3 = { > }; > > static const struct ssam_device_id surface_battery_match[] = { > - { SSAM_SDEV(BAT, SAM, 0x01, 0x00), (unsigned long)&spwr_psy_props_bat1 }, > - { SSAM_SDEV(BAT, KIP, 0x01, 0x00), (unsigned long)&spwr_psy_props_bat2_sb3 }, > - { }, > + { > + SSAM_SDEV(BAT, SAM, 0x01, 0x00), > + .driver_data = (unsigned long)&spwr_psy_props_bat1, > + }, { > + SSAM_SDEV(BAT, KIP, 0x01, 0x00), > + .driver_data = (unsigned long)&spwr_psy_props_bat2_sb3, > + }, > + { } > }; > MODULE_DEVICE_TABLE(ssam, surface_battery_match); > > diff --git a/drivers/power/supply/surface_charger.c b/drivers/power/supply/surface_charger.c > index 90b823848c99..d4bba6b41794 100644 > --- a/drivers/power/supply/surface_charger.c > +++ b/drivers/power/supply/surface_charger.c > @@ -260,8 +260,11 @@ static const struct spwr_psy_properties spwr_psy_props_adp1 = { > }; > > static const struct ssam_device_id surface_ac_match[] = { > - { SSAM_SDEV(BAT, SAM, 0x01, 0x01), (unsigned long)&spwr_psy_props_adp1 }, > - { }, > + { > + SSAM_SDEV(BAT, SAM, 0x01, 0x01), > + .driver_data = (unsigned long)&spwr_psy_props_adp1, > + }, > + { } > }; > MODULE_DEVICE_TABLE(ssam, surface_ac_match); > > > base-commit: c425609d6ac4012c8bbf01ec2e10e801b1923a7b