rtc: max77686: use module_platform_driver()
PATCH 1/5 rtc: max77686: use module_platform_driver()
This patch uses module_platform_driver() macro which makes the code smaller and simpler.
Signed-off-by Jingoo Han <[email protected]>
--- drivers/rtc/rtc-max77686.c | 12 +----------- 1 files changed, 1 insertions(+), 11 deletions(-)
drivers/rtc/rtc-max77686.c +1 -11
@@ -624,17 +624,7 @@ static struct platform_driver max77686_rtc_driver = { .id_table = rtc_id, }; -static int __init max77686_rtc_init (void ) -{ -return platform_driver_register (&max77686_rtc_driver); -} -module_init (max77686_rtc_init); - -static void __exit max77686_rtc_exit(void) -{ -platform_driver_unregister (&max77686_rtc_driver); -} -module_exit (max77686_rtc_exit); +module_platform_driver (max77686_rtc_driver);MODULE_DESCRIPTION ("Maxim MAX77686 RTC driver" );MODULE_AUTHOR ("<[email protected]>" );
Signature · 1 line
1.7.2.5
PATCH 2/5 rtc: max77686: add missing module author name
This patch adds missing module author name to MODULE_AUTHOR macro.
Signed-off-by Jingoo Han <[email protected]>
--- drivers/rtc/rtc-max77686.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/rtc/rtc-max77686.c +1 -1
@@ -627,5 +627,5 @@ static struct platform_driver max77686_rtc_driver = {module_platform_driver (max77686_rtc_driver);MODULE_DESCRIPTION ("Maxim MAX77686 RTC driver" ); -MODULE_AUTHOR ("<[email protected]>" ); +MODULE_AUTHOR ("Chiwoong Byun <[email protected]>" );MODULE_LICENSE ("GPL" );
Signature · 1 line
1.7.2.5
PATCH 3/5 rtc: max77686: use devm_kzalloc()
In reply to Jingoo HanUse devm_kzalloc() to make cleanup paths more simple.
Signed-off-by Jingoo Han <[email protected]>
--- drivers/rtc/rtc-max77686.c | 9 ++------- 1 files changed, 2 insertions(+), 7 deletions(-)
drivers/rtc/rtc-max77686.c +2 -7
@@ -505,7 +505,8 @@ static int max77686_rtc_probe(struct platform_device *pdev)dev_info (&pdev->dev,"%s\n" , __func__); - info =kzalloc (sizeof (struct max77686_rtc_info ),GFP_KERNEL ); + info =devm_kzalloc (&pdev->dev,sizeof (struct max77686_rtc_info ), +GFP_KERNEL );if (!info)return -ENOMEM ;
@@ -519,7 +520,6 @@ static int max77686_rtc_probe(struct platform_device *pdev) ret =PTR_ERR (info->max77686->rtc_regmap);dev_err (info->max77686->dev,"Failed to allocate register map: %d\n" , ret); -kfree (info);return ret; }platform_set_drvdata (pdev, info);
@@ -563,11 +563,7 @@ static int max77686_rtc_probe(struct platform_device *pdev) goto err_rtc; } - goto out; err_rtc: -kfree (info); -return ret; -out:return ret; }
@@ -578,7 +574,6 @@ static int max77686_rtc_remove(struct platform_device *pdev)if (info) {free_irq (info->virq, info);rtc_device_unregister (info->rtc_dev); -kfree (info); }return 0 ;
Signature · 1 line
1.7.2.5
PATCH 4/5 rtc: max77686: fix indentation of bit definitions
In reply to Jingoo HanThis patch fixes indentation of bit definitions to enhance the readability.
Signed-off-by Jingoo Han <[email protected]>
--- drivers/rtc/rtc-max77686.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
drivers/rtc/rtc-max77686.c +5 -5
@@ -24,7 +24,7 @@/* RTC Control Register */ #define BCD_EN_SHIFT 0 -#define BCD_EN_MASK (1 << BCD_EN_SHIFT) +#define BCD_EN_MASK (1 << BCD_EN_SHIFT)#define MODEL24_SHIFT 1#define MODEL24_MASK (1 << MODEL24_SHIFT)/* RTC Update Register1 */
@@ -33,12 +33,12 @@#define RTC_RBUDR_SHIFT 4#define RTC_RBUDR_MASK (1 << RTC_RBUDR_SHIFT)/* WTSR and SMPL Register */ -#define WTSRT_SHIFT 0 -#define SMPLT_SHIFT 2 +#define WTSRT_SHIFT 0 +#define SMPLT_SHIFT 2#define WTSR_EN_SHIFT 6#define SMPL_EN_SHIFT 7 -#define WTSRT_MASK (3 << WTSRT_SHIFT) -#define SMPLT_MASK (3 << SMPLT_SHIFT) +#define WTSRT_MASK (3 << WTSRT_SHIFT) +#define SMPLT_MASK (3 << SMPLT_SHIFT)#define WTSR_EN_MASK (1 << WTSR_EN_SHIFT)#define SMPL_EN_MASK (1 << SMPL_EN_SHIFT)/* RTC Hour register */
Signature · 1 line
1.7.2.5
PATCH 5/5 rtc: max77686: use dev_info()/dev_emerg() instead of pr_info()/pr_emerg()
In reply to Jingoo Handev_info()/dev_emerg() are more preferred than pr_info()/pr_emerg().
Signed-off-by Jingoo Han <[email protected]>
--- drivers/rtc/rtc-max77686.c | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-)
drivers/rtc/rtc-max77686.c +9 -6
@@ -466,7 +466,7 @@ static void max77686_rtc_enable_smpl(struct max77686_rtc_info *info, bool enable val =0 ;regmap_read (info->max77686->rtc_regmap,MAX77686_WTSR_SMPL_CNTL , &val); - pr_info("%s: WTSR_SMPL(0x%02x)\n", __func__, val); + dev_info(info->dev, "%s: WTSR_SMPL(0x%02x)\n", __func__, val); }#endif /* MAX77686_RTC_WTSR_SMPL */
@@ -589,11 +589,14 @@ static void max77686_rtc_shutdown(struct platform_device *pdev)for (i =0 ; i <3 ; i++) {max77686_rtc_enable_wtsr (info, false);regmap_read (info->max77686->rtc_regmap,MAX77686_WTSR_SMPL_CNTL , &val); -pr_info ("%s: WTSR_SMPL reg(0x%02x)\n" , __func__, val); -if (val &WTSR_EN_MASK ) -pr_emerg ("%s: fail to disable WTSR\n" , __func__); -else { -pr_info ("%s: success to disable WTSR\n" , __func__); +dev_info (info->dev,"%s: WTSR_SMPL reg(0x%02x)\n" , __func__, + val); +if (val &WTSR_EN_MASK ) { +dev_emerg (info->dev,"%s: fail to disable WTSR\n" , + __func__); + }else { +dev_info (info->dev,"%s: success to disable WTSR\n" , + __func__);break ; } }
Signature · 1 line
1.7.2.5