Re: [PATCH v2 1/1] rtc: ds3232: get SRAM access using NVMEM Framework

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

 



Hi,

On 08/04/2019 08:52:39+0000, Han Nandor wrote:
>  static int ds3232_probe(struct device *dev, struct regmap *regmap, int irq,
>  			const char *name)
>  {
>  	struct ds3232 *ds3232;
>  	int ret;
> +	struct nvmem_config nvmem_cfg;
>  
>  	ds3232 = devm_kzalloc(dev, sizeof(*ds3232), GFP_KERNEL);
>  	if (!ds3232)
> @@ -476,6 +499,15 @@ static int ds3232_probe(struct device *dev, struct regmap *regmap, int irq,
>  	ds3232->dev = dev;
>  	dev_set_drvdata(dev, ds3232);
>  
> +	nvmem_cfg.name = "ds3232_sram";
> +	nvmem_cfg.stride = 1;
> +	nvmem_cfg.size = DS3232_REG_SRAM_SIZE;
> +	nvmem_cfg.word_size = 1;
> +	nvmem_cfg.reg_read = ds3232_nvmem_read;
> +	nvmem_cfg.reg_write = ds3232_nvmem_write;
> +	nvmem_cfg.priv = ds3232;
> +	nvmem_cfg.type = NVMEM_TYPE_BATTERY_BACKED;
> +

You have to either initialize at the declaration as done here:
https://elixir.bootlin.com/linux/v5.0/source/drivers/rtc/rtc-rv8803.c#L530
or memset the struct to 0. Else, this leaves members uninitialized.


-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com



[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux