Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e3f51c0d authored by Alexandre Belloni's avatar Alexandre Belloni
Browse files

rtc: m48t86: put m48t86_nvmem_cfg on the stack



Move m48t86_nvmem_cfg to the stack of m48t86_rtc_probe. This results in a
very small code size reduction and make it safer on systems with two
similar RTCs:

   text	   data	    bss	    dec	    hex	filename
   1733	    164	      0	   1897	    769	drivers/rtc/rtc-m48t86.o.before
   1793	    100	      0	   1893	    765	drivers/rtc/rtc-m48t86.o.after

Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
parent 3c1bb61f
Loading
Loading
Loading
Loading
+9 −11
Original line number Diff line number Diff line
@@ -218,22 +218,22 @@ static bool m48t86_verify_chip(struct platform_device *pdev)
	return false;
}

static struct nvmem_config m48t86_nvmem_cfg = {
static int m48t86_rtc_probe(struct platform_device *pdev)
{
	struct m48t86_rtc_info *info;
	struct resource *res;
	unsigned char reg;
	int err;
	struct nvmem_config m48t86_nvmem_cfg = {
		.name = "m48t86_nvram",
		.word_size = 1,
		.stride = 1,
		.size = M48T86_NVRAM_LEN,
		.reg_read = m48t86_nvram_read,
		.reg_write = m48t86_nvram_write,
		.priv = &pdev->dev,
	};

static int m48t86_rtc_probe(struct platform_device *pdev)
{
	struct m48t86_rtc_info *info;
	struct resource *res;
	unsigned char reg;
	int err;

	info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
	if (!info)
		return -ENOMEM;
@@ -264,8 +264,6 @@ static int m48t86_rtc_probe(struct platform_device *pdev)
		return PTR_ERR(info->rtc);

	info->rtc->ops = &m48t86_rtc_ops;

	m48t86_nvmem_cfg.priv = &pdev->dev;
	info->rtc->nvram_old_abi = true;

	err = rtc_register_device(info->rtc);