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: <ZAyY3VGlo4N4SLZQ@fedora>
Date:   Sat, 11 Mar 2023 10:06:05 -0500
From:   William Breathitt Gray <william.gray@...aro.org>
To:     Guenter Roeck <linux@...ck-us.net>
Cc:     wim@...ux-watchdog.org, linux-watchdog@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Paul Demetrotion <pdemetrotion@...systems.com>,
        techsupport@...systems.com
Subject: Re: [PATCH] watchdog: ebc-c384_wdt: Migrate to the regmap API

On Sat, Mar 11, 2023 at 06:04:08AM -0800, Guenter Roeck wrote:
> On Fri, Mar 10, 2023 at 07:44:04PM -0500, William Breathitt Gray wrote:
> > The regmap API supports IO port accessors so we can take advantage of
> > regmap abstractions rather than handling access to the device registers
> > directly in the driver.
> > 
> > Suggested-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> > Signed-off-by: William Breathitt Gray <william.gray@...aro.org>
> 
> I assume you did, but just to be sure: Did you test this on hardware ?

I've only done a build test; I no longer have access to a WINSYSTEMS
EBC-C384 motherboard to test this on real hardware. I've CC'd Paul
Demetrotion and the WINSYSTEMS tech support list to this thread as
hopefully one of the WINSYSTEMS engineers may help us test this.

> > @@ -37,43 +40,54 @@ module_param(timeout, uint, 0);
> >  MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds (default="
> >  	__MODULE_STRING(WATCHDOG_TIMEOUT) ")");
> >  
> > +static const struct regmap_range ebc_c384_wdt_wr_ranges[] = {
> > +	regmap_reg_range(0x1, 0x2),
> 
> Any reasons for not using defines ?

I feel direct addresses are somewhat clearer in this context. Regmap
configurations describe the address range of valid read and write
operations. Although the range for this device is simple, other devices
might have multiple ranges with gaps of invalid addresses.

For example, our valid write address range is 0x1-0x2 here:

    regmap_reg_range(0x1, 0x2)

Which is much clearer than trying to match these to register defines:

    regmap_reg_range(CFG_REG, PET_REG)

Because it's not immediately clear that CFG_REG to PET_REG is a
contiguous address range.

> > +};
> > +static const struct regmap_access_table ebc_c384_wdt_wr_table = {
> > +	.yes_ranges = ebc_c384_wdt_wr_ranges,
> > +	.n_yes_ranges = ARRAY_SIZE(ebc_c384_wdt_wr_ranges),
> > +};
> > +static const struct regmap_config ebc_c384_wdt_regmap_config = {
> > +	.reg_bits = 8,
> > +	.reg_stride = 1,
> > +	.val_bits = 8,
> > +	.io_port = true,
> > +	.max_register = 0x2,
> 
> Any reason for not using a define ?

Same reason as above: `max_register = 0x2` is already clear enough and
`max_register = EBC_C384_MAX_REGISTER` wouldn't add any substantial
clarity.

> > +	.wr_table = &ebc_c384_wdt_wr_table,
> > +};
> > +
> >  static int ebc_c384_wdt_start(struct watchdog_device *wdev)
> >  {
> > +	struct regmap *const map = wdev->driver_data;
> 
> Please use watchdog_get_drvdata() and watchdog_set_drvdata() when accessing
> or setting watchdog driver data.
> 
> Guenter

I'll adjust the driver_data interactions in my v2 submission to utilize
watchdog_get_drvdata() and watchdog_set_drvdata().

William Breathitt Gray

Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ