lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAK6c68j2j536UEgq36RAuAv7HGW9VTUS-s32+1YDshqK+gTfzw@mail.gmail.com>
Date: Tue, 4 Nov 2025 20:22:32 +0800
From: Junjie Cao <caojunjie650@...il.com>
To: Krzysztof Kozlowski <krzk@...nel.org>
Cc: Lee Jones <lee@...nel.org>, Daniel Thompson <danielt@...nel.org>, 
	Jingoo Han <jingoohan1@...il.com>, Pavel Machek <pavel@...nel.org>, Rob Herring <robh@...nel.org>, 
	Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>, Helge Deller <deller@....de>, 
	dri-devel@...ts.freedesktop.org, linux-leds@...r.kernel.org, 
	devicetree@...r.kernel.org, linux-kernel@...r.kernel.org, 
	linux-fbdev@...r.kernel.org, Pengyu Luo <mitltlatltl@...il.com>
Subject: Re: [PATCH v2 2/2] backlight: aw99706: Add support for Awinic AW99706 backlight

On Tue, Nov 4, 2025 at 3:36 PM Krzysztof Kozlowski <krzk@...nel.org> wrote:
>
> On Mon, Nov 03, 2025 at 07:06:48PM +0800, Junjie Cao wrote:
> > +struct reg_init_data;
> > +
> > +struct aw99706_device {
> > +     struct i2c_client *client;
> > +     struct device *dev;
> > +     struct regmap *regmap;
> > +     struct backlight_device *bl_dev;
> > +     struct gpio_desc *hwen_gpio;
> > +     struct reg_init_data *init_tbl;
> > +     int init_tbl_size;
> > +     bool bl_enable;
> > +};
> > +
> > +enum reg_access {
> > +     REG_NONE_ACCESS = 0,
> > +     REG_RD_ACCESS   = 1,
> > +     REG_WR_ACCESS   = 2,
> > +};
> > +
> > +const u8 aw99706_regs[AW99706_REG_MAX + 1] = {
>
> Why isn't this static?
>

That was an oversight on my part. It will be static.

> > +     [AW99706_CFG0_REG]              = REG_RD_ACCESS | REG_WR_ACCESS,
> > +     [AW99706_CFG1_REG]              = REG_RD_ACCESS | REG_WR_ACCESS,
> > +     [AW99706_CFG2_REG]              = REG_RD_ACCESS | REG_WR_ACCESS,
> > +     [AW99706_CFG3_REG]              = REG_RD_ACCESS | REG_WR_ACCESS,
> > +     [AW99706_CFG4_REG]              = REG_RD_ACCESS | REG_WR_ACCESS,
> > +     [AW99706_CFG5_REG]              = REG_RD_ACCESS | REG_WR_ACCESS,
> > +     [AW99706_CFG6_REG]              = REG_RD_ACCESS | REG_WR_ACCESS,
> > +     [AW99706_CFG7_REG]              = REG_RD_ACCESS | REG_WR_ACCESS,
> > +     [AW99706_CFG8_REG]              = REG_RD_ACCESS | REG_WR_ACCESS,
> > +     [AW99706_CFG9_REG]              = REG_RD_ACCESS | REG_WR_ACCESS,
> > +     [AW99706_CFGA_REG]              = REG_RD_ACCESS | REG_WR_ACCESS,
> > +     [AW99706_CFGB_REG]              = REG_RD_ACCESS | REG_WR_ACCESS,
> > +     [AW99706_CFGC_REG]              = REG_RD_ACCESS | REG_WR_ACCESS,
> > +     [AW99706_CFGD_REG]              = REG_RD_ACCESS | REG_WR_ACCESS,
> > +     [AW99706_FLAG_REG]              = REG_RD_ACCESS,
> > +     [AW99706_CHIPID_REG]            = REG_RD_ACCESS,
> > +     [AW99706_LED_OPEN_FLAG_REG]     = REG_RD_ACCESS,
> > +     [AW99706_LED_SHORT_FLAG_REG]    = REG_RD_ACCESS,
> > +
> > +     /*
> > +      * Write bit is dropped here, writing BIT(0) to MTPLDOSEL will unlock
> > +      * Multi-time Programmable (MTP).
> > +      */
> > +     [AW99706_MTPLDOSEL_REG]         = REG_RD_ACCESS,
> > +     [AW99706_MTPRUN_REG]            = REG_NONE_ACCESS,
> > +};
> > +
>
> ...
>
> > +     aw = devm_kzalloc(dev, sizeof(*aw), GFP_KERNEL);
> > +     if (!aw)
> > +             return -ENOMEM;
> > +
> > +     aw->client = client;
> > +     aw->dev = dev;
> > +     i2c_set_clientdata(client, aw);
> > +
> > +     aw->regmap = devm_regmap_init_i2c(client, &aw99706_regmap_config);
> > +     if (IS_ERR(aw->regmap))
> > +             return dev_err_probe(dev, PTR_ERR(aw->regmap),
> > +                                  "Failed to init regmap\n");
> > +
> > +     ret = aw99706_chip_id_read(aw);
> > +     if (ret != AW99706_ID)
> > +             return dev_err_probe(dev, ret,
> > +                                  "Failed to validate chip id\n")
>
> Why are you exiting the probe with a positive value like 4 or 8? This
> makes no sense. Registers do not coontain Linux return codes.
>

Thanks for pointing this out. Using -ENODEV makes more sense. I will do
it in the next version.

Regards,
Junjie

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ