[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4eab619f-6da9-4aff-b956-69d8e2ecd47f@sirena.org.uk>
Date: Tue, 18 Jun 2024 15:08:00 +0100
From: Mark Brown <broonie@...nel.org>
To: Dzmitry Sankouski <dsankouski@...il.com>
Cc: Sebastian Reichel <sre@...nel.org>,
Bjorn Andersson <andersson@...nel.org>,
Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...nel.org>,
Neil Armstrong <neil.armstrong@...aro.org>,
Jessica Zhang <quic_jesszhan@...cinc.com>,
Sam Ravnborg <sam@...nborg.org>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>, Daniel Vetter <daniel@...ll.ch>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>, Lee Jones <lee@...nel.org>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Pavel Machek <pavel@....cz>, Liam Girdwood <lgirdwood@...il.com>,
Uwe Kleine-König <ukleinek@...nel.org>,
Krzysztof Kozlowski <krzk@...nel.org>,
Konrad Dybcio <konrad.dybcio@...aro.org>,
Chanwoo Choi <cw00.choi@...sung.com>, phone-devel@...r.kernel.org,
linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-msm@...r.kernel.org, linux-clk@...r.kernel.org,
dri-devel@...ts.freedesktop.org, devicetree@...r.kernel.org,
linux-input@...r.kernel.org, linux-leds@...r.kernel.org,
linux-pwm@...r.kernel.org, linux-samsung-soc@...r.kernel.org
Subject: Re: [PATCH v3 18/23] regulator: add s2dos05 regulator support
On Tue, Jun 18, 2024 at 04:59:52PM +0300, Dzmitry Sankouski wrote:
> index 000000000000..3c58a1bd2262
> --- /dev/null
> +++ b/drivers/regulator/s2dos05-regulator.c
> @@ -0,0 +1,362 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * s2dos05.c - Regulator driver for the Samsung s2dos05
> + *
Please make the entire comment a C++ one so things look more
intentional.
> +static int s2m_enable(struct regulator_dev *rdev)
> +{
> + struct s2dos05_data *info = rdev_get_drvdata(rdev);
> + struct regmap *regmap = info->regmap;
> +
> + return regmap_update_bits(regmap, rdev->desc->enable_reg,
> + rdev->desc->enable_mask,
> + rdev->desc->enable_mask);
> +}
Please use the generic regmap helpers rather than open coding them.
> + reg_np = of_get_child_by_name(dev->parent->of_node, "regulators");
> + if (!reg_np) {
> + dev_err(dev, "could not find regulators sub-node\n");
> + return -EINVAL;
> + }
> +
> + err = of_regulator_match(dev, reg_np, rdata, rdev_num);
> + of_node_put(reg_np);
Use of_match for this rather than open coding.
> + s2dos05 = devm_kzalloc(dev, sizeof(struct s2dos05_data),
> + GFP_KERNEL);
> + rdata = kcalloc(rdev_num, sizeof(*rdata), GFP_KERNEL);
> + if (!rdata)
> + return -ENOMEM;
Mixing devm_ and regular allocations seems likely to go wrong, please be
consistent.
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists