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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200527160950.p3brpiup3pihlzi6@mobilestation>
Date:   Wed, 27 May 2020 19:09:50 +0300
From:   Serge Semin <Sergey.Semin@...kalelectronics.ru>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
CC:     Serge Semin <fancer.lancer@...il.com>,
        Jarkko Nikula <jarkko.nikula@...ux.intel.com>,
        Wolfram Sang <wsa@...-dreams.de>,
        Mika Westerberg <mika.westerberg@...ux.intel.com>,
        Alexey Malahov <Alexey.Malahov@...kalelectronics.ru>,
        Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
        Rob Herring <robh+dt@...nel.org>, <devicetree@...r.kernel.org>,
        <linux-mips@...r.kernel.org>, <linux-i2c@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v5 08/11] i2c: designware: Convert driver to using regmap
 API

On Wed, May 27, 2020 at 07:03:37PM +0300, Andy Shevchenko wrote:
> On Wed, May 27, 2020 at 06:30:43PM +0300, Serge Semin wrote:
> > Seeing the DW I2C driver is using flags-based accessors with two
> > conditional clauses it would be better to replace them with the regmap
> > API IO methods and to initialize the regmap object with read/write
> > callbacks specific to the controller registers map implementation. This
> > will be also handy for the drivers with non-standard registers mapping
> > (like an embedded into the Baikal-T1 System Controller DW I2C block, which
> > glue-driver is a part of this series).
> > 
> > As before the driver tries to detect the mapping setup at probe stage and
> > creates a regmap object accordingly, which will be used by the rest of the
> > code to correctly access the controller registers. In two places it was
> > appropriate to convert the hand-written read-modify-write and
> > read-poll-loop design patterns to the corresponding regmap API
> > ready-to-use methods.
> > 
> > Note the regmap IO methods return value is checked only at the probe
> > stage. The rest of the code won't do this because basically we have
> > MMIO-based regmap so non of the read/write methods can fail (this also
> > won't be needed for the Baikal-T1-specific I2C controller).
> 
> ...
> 
> > +	struct regmap_config map_cfg = {
> > +		.reg_bits = 32,
> > +		.val_bits = 32,
> > +		.reg_stride = 4,
> > +		.disable_locking = true,
> > +		.reg_read = dw_reg_read,
> > +		.reg_write = dw_reg_write,
> 
> > +		.max_register = DW_IC_COMP_TYPE
> 

> Perhaps leave comma here as well.

If v6 is required, it'll be fixed there.

-Sergey

> 
> > +	};
> 
> ...
> 
> > +	/*
> > +	 * Note we'll check the return value of the regmap IO accessors only
> > +	 * at the probe stage. The rest of the code won't do this because
> > +	 * basically we have MMIO-based regmap so non of the read/write methods
> > +	 * can fail.
> > +	 */
> > +	dev->map = devm_regmap_init(dev->dev, NULL, dev, &map_cfg);
> > +	if (IS_ERR(dev->map)) {
> > +		dev_err(dev->dev, "Failed to init the registers map\n");
> 
> > +		return PTR_ERR(dev->map);
> > +	}
> > +
> >  	return 0;
> 
> 	return PTR_ERR_OR_ZERO(dev->map);
> 
> -- 
> With Best Regards,
> Andy Shevchenko
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ