public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] rtc: max77686: use module_platform_driver()
@ 2013-02-27  5:57 Jingoo Han
  2013-02-27  5:57 ` [PATCH 2/5] rtc: max77686: add missing module author name Jingoo Han
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Jingoo Han @ 2013-02-27  5:57 UTC (permalink / raw)
  To: 'Andrew Morton'
  Cc: linux-kernel, 'Alessandro Zummo', rtc-linux,
	'Jonghwa Lee', 'Jingoo Han'

This patch uses module_platform_driver() macro which makes
the code smaller and simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/rtc/rtc-max77686.c |   12 +-----------
 1 files changed, 1 insertions(+), 11 deletions(-)

diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c
index 6b1337f..a8e31fc 100644
--- a/drivers/rtc/rtc-max77686.c
+++ b/drivers/rtc/rtc-max77686.c
@@ -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("<woong.byun@samsung.com>");
-- 
1.7.2.5



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/5] rtc: max77686: add missing module author name
  2013-02-27  5:57 [PATCH 1/5] rtc: max77686: use module_platform_driver() Jingoo Han
@ 2013-02-27  5:57 ` Jingoo Han
  2013-02-27  5:58 ` [PATCH 3/5] rtc: max77686: use devm_kzalloc() Jingoo Han
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Jingoo Han @ 2013-02-27  5:57 UTC (permalink / raw)
  To: 'Andrew Morton'
  Cc: linux-kernel, 'Alessandro Zummo', rtc-linux,
	'Jonghwa Lee', 'Jingoo Han'

This patch adds missing module author name to MODULE_AUTHOR macro.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/rtc/rtc-max77686.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c
index a8e31fc..4da2a55 100644
--- a/drivers/rtc/rtc-max77686.c
+++ b/drivers/rtc/rtc-max77686.c
@@ -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("<woong.byun@samsung.com>");
+MODULE_AUTHOR("Chiwoong Byun <woong.byun@samsung.com>");
 MODULE_LICENSE("GPL");
-- 
1.7.2.5



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/5] rtc: max77686: use devm_kzalloc()
  2013-02-27  5:57 [PATCH 1/5] rtc: max77686: use module_platform_driver() Jingoo Han
  2013-02-27  5:57 ` [PATCH 2/5] rtc: max77686: add missing module author name Jingoo Han
@ 2013-02-27  5:58 ` Jingoo Han
  2013-02-27  5:58 ` [PATCH 4/5] rtc: max77686: fix indentation of bit definitions Jingoo Han
  2013-02-27  5:58 ` [PATCH 5/5] rtc: max77686: use dev_info()/dev_emerg() instead of pr_info()/pr_emerg() Jingoo Han
  3 siblings, 0 replies; 5+ messages in thread
From: Jingoo Han @ 2013-02-27  5:58 UTC (permalink / raw)
  To: 'Andrew Morton'
  Cc: linux-kernel, 'Alessandro Zummo', rtc-linux,
	'Jonghwa Lee', 'Jingoo Han'

Use devm_kzalloc() to make cleanup paths more simple.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/rtc/rtc-max77686.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c
index 4da2a55..36b1f5c 100644
--- a/drivers/rtc/rtc-max77686.c
+++ b/drivers/rtc/rtc-max77686.c
@@ -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;
-- 
1.7.2.5



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 4/5] rtc: max77686: fix indentation of bit definitions
  2013-02-27  5:57 [PATCH 1/5] rtc: max77686: use module_platform_driver() Jingoo Han
  2013-02-27  5:57 ` [PATCH 2/5] rtc: max77686: add missing module author name Jingoo Han
  2013-02-27  5:58 ` [PATCH 3/5] rtc: max77686: use devm_kzalloc() Jingoo Han
@ 2013-02-27  5:58 ` Jingoo Han
  2013-02-27  5:58 ` [PATCH 5/5] rtc: max77686: use dev_info()/dev_emerg() instead of pr_info()/pr_emerg() Jingoo Han
  3 siblings, 0 replies; 5+ messages in thread
From: Jingoo Han @ 2013-02-27  5:58 UTC (permalink / raw)
  To: 'Andrew Morton'
  Cc: linux-kernel, 'Alessandro Zummo', rtc-linux,
	'Jonghwa Lee', 'Jingoo Han'

This patch fixes indentation of bit definitions to enhance the
readability.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/rtc/rtc-max77686.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c
index 36b1f5c..9de93e7 100644
--- a/drivers/rtc/rtc-max77686.c
+++ b/drivers/rtc/rtc-max77686.c
@@ -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 */
-- 
1.7.2.5



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 5/5] rtc: max77686: use dev_info()/dev_emerg() instead of pr_info()/pr_emerg()
  2013-02-27  5:57 [PATCH 1/5] rtc: max77686: use module_platform_driver() Jingoo Han
                   ` (2 preceding siblings ...)
  2013-02-27  5:58 ` [PATCH 4/5] rtc: max77686: fix indentation of bit definitions Jingoo Han
@ 2013-02-27  5:58 ` Jingoo Han
  3 siblings, 0 replies; 5+ messages in thread
From: Jingoo Han @ 2013-02-27  5:58 UTC (permalink / raw)
  To: 'Andrew Morton'
  Cc: linux-kernel, 'Alessandro Zummo', rtc-linux,
	'Jonghwa Lee', 'Jingoo Han'

dev_info()/dev_emerg() are more preferred than pr_info()/pr_emerg().

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/rtc/rtc-max77686.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c
index 9de93e7..df66bab 100644
--- a/drivers/rtc/rtc-max77686.c
+++ b/drivers/rtc/rtc-max77686.c
@@ -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;
 		}
 	}
-- 
1.7.2.5



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-02-27  5:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-27  5:57 [PATCH 1/5] rtc: max77686: use module_platform_driver() Jingoo Han
2013-02-27  5:57 ` [PATCH 2/5] rtc: max77686: add missing module author name Jingoo Han
2013-02-27  5:58 ` [PATCH 3/5] rtc: max77686: use devm_kzalloc() Jingoo Han
2013-02-27  5:58 ` [PATCH 4/5] rtc: max77686: fix indentation of bit definitions Jingoo Han
2013-02-27  5:58 ` [PATCH 5/5] rtc: max77686: use dev_info()/dev_emerg() instead of pr_info()/pr_emerg() Jingoo Han

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox