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

Commit 5508c725 authored by Alexandre Belloni's avatar Alexandre Belloni
Browse files

rtc: m48t86: switch to rtc_register_device



This allows for future improvement of the driver.

Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
parent 41e607f2
Loading
Loading
Loading
Loading
+8 −2
Original line number Original line Diff line number Diff line
@@ -228,6 +228,7 @@ static int m48t86_rtc_probe(struct platform_device *pdev)
	struct m48t86_rtc_info *info;
	struct m48t86_rtc_info *info;
	struct resource *res;
	struct resource *res;
	unsigned char reg;
	unsigned char reg;
	int err;


	info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
	info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
	if (!info)
	if (!info)
@@ -254,11 +255,16 @@ static int m48t86_rtc_probe(struct platform_device *pdev)
		return -ENODEV;
		return -ENODEV;
	}
	}


	info->rtc = devm_rtc_device_register(&pdev->dev, "m48t86",
	info->rtc = devm_rtc_allocate_device(&pdev->dev);
					     &m48t86_rtc_ops, THIS_MODULE);
	if (IS_ERR(info->rtc))
	if (IS_ERR(info->rtc))
		return PTR_ERR(info->rtc);
		return PTR_ERR(info->rtc);


	info->rtc->ops = &m48t86_rtc_ops;

	err = rtc_register_device(info->rtc);
	if (err)
		return err;

	/* read battery status */
	/* read battery status */
	reg = m48t86_readb(&pdev->dev, M48T86_D);
	reg = m48t86_readb(&pdev->dev, M48T86_D);
	dev_info(&pdev->dev, "battery %s\n",
	dev_info(&pdev->dev, "battery %s\n",