From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from luna.linkmauve.fr (82-65-109-163.subs.proxad.net [82.65.109.163]) (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 6812F1E47CC; Sun, 26 Jul 2026 12:56:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=82.65.109.163 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785070586; cv=none; b=jHd98EE3kAYZnWiBhz35W/E/Lg6MC8IQKfNVf1W3LZZxHFmsM6nyMm5ttoijT9JHo+/kZBfljIYJSXvATKvCCJUiF5TaJ753ARbH+hhU0CXuPFE6iPpZgqo3f7ZjX+0wVcG7JVIWtmIHh2KH9ybOZYNfALpG6p4/EQPiyb7K9hk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785070586; c=relaxed/simple; bh=qOWSLoFTRbEIxSauVxZ4vA0xfF8LEiuIbFTNM/LfThE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ftKbnf6RMAomj3nOPvIWdnHj0atfa2OmPZ1j2D+w7j6uTkp48dUlE9cV6Bjql2VuoEHqU6HVOHjvHRvfizM3PpPip3HGOZ53YLV8dV4L2ClEhNgTtHtHtc1od7xaDUlw7jTvQyd3QP3x13+AmmgRf5DNr/GWCasPGmsEg4X5KLY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linkmauve.fr; spf=pass smtp.mailfrom=linkmauve.fr; arc=none smtp.client-ip=82.65.109.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linkmauve.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linkmauve.fr Received: by luna.linkmauve.fr (Postfix, from userid 1000) id 046A5F40DDF; Sun, 26 Jul 2026 14:56:17 +0200 (CEST) Date: Sun, 26 Jul 2026 14:56:16 +0200 From: Link Mauve To: Andy Shevchenko Cc: Link Mauve , Srinivas Kandagatla , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Sven Peter , Janne Grunau , Neal Gompa , Frank Li , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Vladimir Zapolskiy , =?iso-8859-1?Q?Andr=E9?= Draszik , Orson Zhai , Baolin Wang , Chunyan Zhang , Maxime Coquelin , Alexandre Torgue , Kalyani Akula , Michal Simek , Miguel Ojeda , Boqun Feng , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Daniel Almeida , Tamir Duberstein , Alexandre Courbot , Onur =?iso-8859-1?Q?=D6zkan?= , Johan Hovold , Ronald Claveau , Daniel Lezcano , linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, asahi@lists.linux.dev, imx@lists.linux.dev, linux-arm-msm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, rust-for-linux@vger.kernel.org Subject: Re: [PATCH v3 3/4] nvmem: apple-spmi: improve calling safety with wrapper functions Message-ID: References: <20260716142415.28718-1-linkmauve@linkmauve.fr> <20260716142415.28718-4-linkmauve@linkmauve.fr> Precedence: bulk X-Mailing-List: asahi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Jabber-ID: linkmauve@linkmauve.fr Ah, someone independently sent the same patch as this one in 7089170e1df160f5f8fb395bc5aa2e2697b4e896, so I’ll drop it from v4. Sorry it took that long! On Thu, Jul 16, 2026 at 09:07:13PM +0300, Andy Shevchenko wrote: > On Thu, Jul 16, 2026 at 04:24:10PM +0200, Link Mauve wrote: > > This driver used to cast the regmap_bulk_*() functions to void *, > > bypassing any compiler safety around incompatible function pointers. > > > > With two small wrappers, which just convert the void * priv parameter > > into the wanted struct regmap *, we can remove the void * cast > > altogether. > > Reported-by: ? > > > Signed-off-by: Link Mauve > > ... > > > +static int apple_spmi_nvmem_read(void *priv, unsigned int offset, > > + void *val, size_t bytes) > > +{ > > > + struct regmap *regmap = priv; > > No need :-) > > > + return regmap_bulk_read(regmap, offset, val, bytes); > > +} > > static int apple_spmi_nvmem_read(void *map, unsigned int offset, > void *val, size_t bytes) > { > return regmap_bulk_read(map, offset, val, bytes); > } > > ... > > > +static int apple_spmi_nvmem_write(void *priv, unsigned int offset, > > + const void *val, size_t bytes) > > +{ > > + struct regmap *regmap = priv; > > + return regmap_bulk_write(regmap, offset, val, bytes); > > +} > > In the similar way as above. > > ... > > > - .reg_read = (void *)regmap_bulk_read, > > - .reg_write_const = (void *)regmap_bulk_write, > > + .reg_read = apple_spmi_nvmem_read, > > + .reg_write_const = apple_spmi_nvmem_write, > > I think the proper ordering is to address this first (before your main change) > and update later with const argument. Yes, it will be a bit more changes, but > it will be cleaner. > > -- > With Best Regards, > Andy Shevchenko > > -- Link Mauve