diff mbox

[v1,12/16] rtc: mediatek: cleanup header files to include

Message ID 6e4f709162d57c6e81dfca0996f88358080bf411.1521794177.git.sean.wang@mediatek.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Sean Wang March 23, 2018, 9:15 a.m. UTC
From: Sean Wang <sean.wang@mediatek.com>

Clean up those included header files by removing unreferenced ones,
add missing ones the driver explicitly depends on and finally list
all #includes in alphabetical order.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
 drivers/rtc/rtc-mt6397.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

Comments

kernel test robot March 25, 2018, 4:17 a.m. UTC | #1
Hi Sean,

I love your patch! Yet something to improve:

[auto build test ERROR on abelloni/rtc-next]
[also build test ERROR on v4.16-rc6 next-20180323]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/sean-wang-mediatek-com/Add-support-to-MT6323-RTC-and-its-power-device/20180325-104529
base:   https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
config: x86_64-randconfig-x004-201812 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers//rtc/rtc-mt6397.c: In function 'mtk_rtc_probe':
>> drivers//rtc/rtc-mt6397.c:270:13: error: implicit declaration of function 'irq_create_mapping'; did you mean 'qid_has_mapping'? [-Werror=implicit-function-declaration]
     rtc->irq = irq_create_mapping(mt6397_chip->irq_domain, res->start);
                ^~~~~~~~~~~~~~~~~~
                qid_has_mapping
   Cyclomatic Complexity 1 include/linux/err.h:PTR_ERR
   Cyclomatic Complexity 1 include/linux/err.h:IS_ERR
   Cyclomatic Complexity 1 include/linux/math64.h:div_s64_rem
   Cyclomatic Complexity 1 include/linux/math64.h:div_s64
   Cyclomatic Complexity 3 include/linux/ktime.h:ktime_compare
   Cyclomatic Complexity 1 include/linux/ktime.h:ktime_add_us
   Cyclomatic Complexity 1 include/linux/device.h:devm_kzalloc
   Cyclomatic Complexity 1 include/linux/pm_wakeup.h:device_set_wakeup_capable
   Cyclomatic Complexity 1 include/linux/pm_wakeup.h:device_set_wakeup_enable
   Cyclomatic Complexity 1 include/linux/pm_wakeup.h:device_init_wakeup
   Cyclomatic Complexity 1 include/linux/device.h:dev_get_drvdata
   Cyclomatic Complexity 1 include/linux/device.h:dev_set_drvdata
   Cyclomatic Complexity 1 include/linux/platform_device.h:platform_set_drvdata
   Cyclomatic Complexity 1 include/linux/of_platform.h:devm_of_platform_populate
   Cyclomatic Complexity 1 drivers//rtc/rtc-mt6397.c:mtk_rtc_driver_init
   Cyclomatic Complexity 5 drivers//rtc/rtc-mt6397.c:mtk_rtc_probe
   Cyclomatic Complexity 11 drivers//rtc/rtc-mt6397.c:mtk_rtc_write_trigger
   Cyclomatic Complexity 6 drivers//rtc/rtc-mt6397.c:mtk_rtc_set_alarm
   Cyclomatic Complexity 2 drivers//rtc/rtc-mt6397.c:mtk_rtc_set_time
   Cyclomatic Complexity 4 drivers//rtc/rtc-mt6397.c:mtk_rtc_read_alarm
   Cyclomatic Complexity 2 drivers//rtc/rtc-mt6397.c:__mtk_rtc_read_time
   Cyclomatic Complexity 3 drivers//rtc/rtc-mt6397.c:mtk_rtc_read_time
   Cyclomatic Complexity 4 drivers//rtc/rtc-mt6397.c:mtk_rtc_irq_handler_thread
   Cyclomatic Complexity 1 drivers//rtc/rtc-mt6397.c:mtk_rtc_driver_exit
   cc1: some warnings being treated as errors

vim +270 drivers//rtc/rtc-mt6397.c

fc2979118 Tianping Fang  2015-05-06  254  
fc2979118 Tianping Fang  2015-05-06  255  static int mtk_rtc_probe(struct platform_device *pdev)
fc2979118 Tianping Fang  2015-05-06  256  {
fc2979118 Tianping Fang  2015-05-06  257  	struct resource *res;
fc2979118 Tianping Fang  2015-05-06  258  	struct mt6397_chip *mt6397_chip = dev_get_drvdata(pdev->dev.parent);
fc2979118 Tianping Fang  2015-05-06  259  	struct mt6397_rtc *rtc;
fc2979118 Tianping Fang  2015-05-06  260  	int ret;
fc2979118 Tianping Fang  2015-05-06  261  
fc2979118 Tianping Fang  2015-05-06  262  	rtc = devm_kzalloc(&pdev->dev, sizeof(struct mt6397_rtc), GFP_KERNEL);
fc2979118 Tianping Fang  2015-05-06  263  	if (!rtc)
fc2979118 Tianping Fang  2015-05-06  264  		return -ENOMEM;
fc2979118 Tianping Fang  2015-05-06  265  
fc2979118 Tianping Fang  2015-05-06  266  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
fc2979118 Tianping Fang  2015-05-06  267  	rtc->addr_base = res->start;
fc2979118 Tianping Fang  2015-05-06  268  
fc2979118 Tianping Fang  2015-05-06  269  	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
fc2979118 Tianping Fang  2015-05-06 @270  	rtc->irq = irq_create_mapping(mt6397_chip->irq_domain, res->start);
fc2979118 Tianping Fang  2015-05-06  271  	if (rtc->irq <= 0)
fc2979118 Tianping Fang  2015-05-06  272  		return -EINVAL;
fc2979118 Tianping Fang  2015-05-06  273  
fc2979118 Tianping Fang  2015-05-06  274  	rtc->regmap = mt6397_chip->regmap;
fc2979118 Tianping Fang  2015-05-06  275  	rtc->dev = &pdev->dev;
fc2979118 Tianping Fang  2015-05-06  276  	mutex_init(&rtc->lock);
fc2979118 Tianping Fang  2015-05-06  277  
fc2979118 Tianping Fang  2015-05-06  278  	platform_set_drvdata(pdev, rtc);
fc2979118 Tianping Fang  2015-05-06  279  
66c231b40 Sean Wang      2018-03-23  280  	ret = devm_request_threaded_irq(&pdev->dev, rtc->irq, NULL,
fc2979118 Tianping Fang  2015-05-06  281  					mtk_rtc_irq_handler_thread,
fc2979118 Tianping Fang  2015-05-06  282  					IRQF_ONESHOT | IRQF_TRIGGER_HIGH,
fc2979118 Tianping Fang  2015-05-06  283  					"mt6397-rtc", rtc);
fc2979118 Tianping Fang  2015-05-06  284  	if (ret) {
fc2979118 Tianping Fang  2015-05-06  285  		dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n",
fc2979118 Tianping Fang  2015-05-06  286  			rtc->irq, ret);
63044753b Sean Wang      2018-03-23  287  		return ret;
fc2979118 Tianping Fang  2015-05-06  288  	}
fc2979118 Tianping Fang  2015-05-06  289  
baeca4495 Wei-Ning Huang 2015-07-02  290  	device_init_wakeup(&pdev->dev, 1);
baeca4495 Wei-Ning Huang 2015-07-02  291  
66c231b40 Sean Wang      2018-03-23  292  	rtc->rtc_dev = devm_rtc_device_register(&pdev->dev, "mt6397-rtc",
fc2979118 Tianping Fang  2015-05-06  293  						&mtk_rtc_ops, THIS_MODULE);
fc2979118 Tianping Fang  2015-05-06  294  	if (IS_ERR(rtc->rtc_dev)) {
fc2979118 Tianping Fang  2015-05-06  295  		dev_err(&pdev->dev, "register rtc device failed\n");
fc2979118 Tianping Fang  2015-05-06  296  		ret = PTR_ERR(rtc->rtc_dev);
fc2979118 Tianping Fang  2015-05-06  297  		return ret;
fc2979118 Tianping Fang  2015-05-06  298  	}
fc2979118 Tianping Fang  2015-05-06  299  
89a68f3c0 Sean Wang      2018-03-23  300  	return devm_of_platform_populate(&pdev->dev);
fc2979118 Tianping Fang  2015-05-06  301  }
fc2979118 Tianping Fang  2015-05-06  302  

:::::: The code at line 270 was first introduced by commit
:::::: fc2979118f3f5193475cb53d5df7bdaa7e358a42 rtc: mediatek: Add MT6397 RTC driver

:::::: TO: Tianping Fang <tianping.fang@mediatek.com>
:::::: CC: Alexandre Belloni <alexandre.belloni@free-electrons.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot March 25, 2018, 5:21 a.m. UTC | #2
Hi Sean,

I love your patch! Yet something to improve:

[auto build test ERROR on abelloni/rtc-next]
[also build test ERROR on v4.16-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/sean-wang-mediatek-com/Add-support-to-MT6323-RTC-and-its-power-device/20180325-104529
base:   https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
config: tile-allmodconfig (attached as .config)
compiler: tilegx-linux-gcc (GCC) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=tile 

All errors (new ones prefixed by >>):

   drivers//rtc/rtc-mt6397.c: In function 'mtk_rtc_probe':
>> drivers//rtc/rtc-mt6397.c:270:13: error: implicit declaration of function 'irq_create_mapping'; did you mean 'page_mapping'? [-Werror=implicit-function-declaration]
     rtc->irq = irq_create_mapping(mt6397_chip->irq_domain, res->start);
                ^~~~~~~~~~~~~~~~~~
                page_mapping
   cc1: some warnings being treated as errors

vim +270 drivers//rtc/rtc-mt6397.c

fc2979118 Tianping Fang  2015-05-06  254  
fc2979118 Tianping Fang  2015-05-06  255  static int mtk_rtc_probe(struct platform_device *pdev)
fc2979118 Tianping Fang  2015-05-06  256  {
fc2979118 Tianping Fang  2015-05-06  257  	struct resource *res;
fc2979118 Tianping Fang  2015-05-06  258  	struct mt6397_chip *mt6397_chip = dev_get_drvdata(pdev->dev.parent);
fc2979118 Tianping Fang  2015-05-06  259  	struct mt6397_rtc *rtc;
fc2979118 Tianping Fang  2015-05-06  260  	int ret;
fc2979118 Tianping Fang  2015-05-06  261  
fc2979118 Tianping Fang  2015-05-06  262  	rtc = devm_kzalloc(&pdev->dev, sizeof(struct mt6397_rtc), GFP_KERNEL);
fc2979118 Tianping Fang  2015-05-06  263  	if (!rtc)
fc2979118 Tianping Fang  2015-05-06  264  		return -ENOMEM;
fc2979118 Tianping Fang  2015-05-06  265  
fc2979118 Tianping Fang  2015-05-06  266  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
fc2979118 Tianping Fang  2015-05-06  267  	rtc->addr_base = res->start;
fc2979118 Tianping Fang  2015-05-06  268  
fc2979118 Tianping Fang  2015-05-06  269  	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
fc2979118 Tianping Fang  2015-05-06 @270  	rtc->irq = irq_create_mapping(mt6397_chip->irq_domain, res->start);
fc2979118 Tianping Fang  2015-05-06  271  	if (rtc->irq <= 0)
fc2979118 Tianping Fang  2015-05-06  272  		return -EINVAL;
fc2979118 Tianping Fang  2015-05-06  273  
fc2979118 Tianping Fang  2015-05-06  274  	rtc->regmap = mt6397_chip->regmap;
fc2979118 Tianping Fang  2015-05-06  275  	rtc->dev = &pdev->dev;
fc2979118 Tianping Fang  2015-05-06  276  	mutex_init(&rtc->lock);
fc2979118 Tianping Fang  2015-05-06  277  
fc2979118 Tianping Fang  2015-05-06  278  	platform_set_drvdata(pdev, rtc);
fc2979118 Tianping Fang  2015-05-06  279  
66c231b40 Sean Wang      2018-03-23  280  	ret = devm_request_threaded_irq(&pdev->dev, rtc->irq, NULL,
fc2979118 Tianping Fang  2015-05-06  281  					mtk_rtc_irq_handler_thread,
fc2979118 Tianping Fang  2015-05-06  282  					IRQF_ONESHOT | IRQF_TRIGGER_HIGH,
fc2979118 Tianping Fang  2015-05-06  283  					"mt6397-rtc", rtc);
fc2979118 Tianping Fang  2015-05-06  284  	if (ret) {
fc2979118 Tianping Fang  2015-05-06  285  		dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n",
fc2979118 Tianping Fang  2015-05-06  286  			rtc->irq, ret);
63044753b Sean Wang      2018-03-23  287  		return ret;
fc2979118 Tianping Fang  2015-05-06  288  	}
fc2979118 Tianping Fang  2015-05-06  289  
baeca4495 Wei-Ning Huang 2015-07-02  290  	device_init_wakeup(&pdev->dev, 1);
baeca4495 Wei-Ning Huang 2015-07-02  291  
66c231b40 Sean Wang      2018-03-23  292  	rtc->rtc_dev = devm_rtc_device_register(&pdev->dev, "mt6397-rtc",
fc2979118 Tianping Fang  2015-05-06  293  						&mtk_rtc_ops, THIS_MODULE);
fc2979118 Tianping Fang  2015-05-06  294  	if (IS_ERR(rtc->rtc_dev)) {
fc2979118 Tianping Fang  2015-05-06  295  		dev_err(&pdev->dev, "register rtc device failed\n");
fc2979118 Tianping Fang  2015-05-06  296  		ret = PTR_ERR(rtc->rtc_dev);
fc2979118 Tianping Fang  2015-05-06  297  		return ret;
fc2979118 Tianping Fang  2015-05-06  298  	}
fc2979118 Tianping Fang  2015-05-06  299  
89a68f3c0 Sean Wang      2018-03-23  300  	return devm_of_platform_populate(&pdev->dev);
fc2979118 Tianping Fang  2015-05-06  301  }
fc2979118 Tianping Fang  2015-05-06  302  

:::::: The code at line 270 was first introduced by commit
:::::: fc2979118f3f5193475cb53d5df7bdaa7e358a42 rtc: mediatek: Add MT6397 RTC driver

:::::: TO: Tianping Fang <tianping.fang@mediatek.com>
:::::: CC: Alexandre Belloni <alexandre.belloni@free-electrons.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c
index 015609d..f5dc70d 100644
--- a/drivers/rtc/rtc-mt6397.c
+++ b/drivers/rtc/rtc-mt6397.c
@@ -12,18 +12,15 @@ 
 * GNU General Public License for more details.
 */
 
-#include <linux/delay.h>
-#include <linux/init.h>
+#include <linux/err.h>
 #include <linux/interrupt.h>
+#include <linux/mfd/mt6397/core.h>
 #include <linux/module.h>
+#include <linux/mutex.h>
 #include <linux/of_platform.h>
+#include <linux/platform_device.h>
 #include <linux/regmap.h>
 #include <linux/rtc.h>
-#include <linux/platform_device.h>
-#include <linux/of_address.h>
-#include <linux/of_irq.h>
-#include <linux/io.h>
-#include <linux/mfd/mt6397/core.h>
 #include <linux/rtc/mt6397.h>
 
 static int mtk_rtc_write_trigger(struct mt6397_rtc *rtc)