Re: [PATCH v53 2/6] can: mcp25xxfd: add regmap infrastructure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 18, 2020 at 07:25:32PM +0200, Marc Kleine-Budde wrote:

> +static int
> +mcp25xxfd_regmap_nocrc_update_bits(void *context, unsigned int reg,
> +				   unsigned int mask, unsigned int val)
> +{

This doesn't look like the hardware has an update_bits() operation so
why is there a driver specific implementation?

> +static int
> +mcp25xxfd_regmap_init_nocrc(struct mcp25xxfd_priv *priv)
> +{
> +	if (!priv->map_nocrc) {
> +		struct regmap *map;
> +
> +		map = devm_regmap_init(&priv->spi->dev, &mcp25xxfd_bus_nocrc,
> +				       priv->spi, &mcp25xxfd_regmap_nocrc);

Why all these checks to see if things might already be allocated?

> +static void mcp25xxfd_regmap_destroy_nocrc(struct mcp25xxfd_priv *priv)
> +{
> +	if (priv->map_buf_nocrc_rx) {
> +		devm_kfree(&priv->spi->dev, priv->map_buf_nocrc_rx);
> +		priv->map_buf_nocrc_rx = NULL;
> +	}

Why explicitly free managed allocations like this?

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux