Subject: [arm-platforms:hack/devm_cast_abuse 3/17] drivers/tty/serial/sccnxp.c:923:9: error: implicit declaration of function 'devm_clk_prepare_enable'; did you mean

From: kernel test robot <[email-masked]>
Date: Wed, 16 Dec 2020 05:23:45 +0800

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git hack/devm_cast_abuse
head:   542cb40d75bf747a26ac91aa28f1a1ecb19b89e3
commit: 987add0e7cd705f0bf7beaa0543440d7db4a5736 [3/17] serial: sccnxp: Convert to devm_clk_prepare_enable()
config: sparc-randconfig-r022-20201215 (attached as .config)
compiler: sparc64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git/commit/?id=987add0e7cd705f0bf7beaa0543440d7db4a5736
        git remote add arm-platforms https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git
        git fetch --no-tags arm-platforms hack/devm_cast_abuse
        git checkout 987add0e7cd705f0bf7beaa0543440d7db4a5736
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sparc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email-masked]>

All errors (new ones prefixed by >>):

   drivers/tty/serial/sccnxp.c: In function 'sccnxp_probe':
>> drivers/tty/serial/sccnxp.c:923:9: error: implicit declaration of function 'devm_clk_prepare_enable'; did you mean 'clk_prepare_enable'? [-Werror=implicit-function-declaration]
     923 |   ret = devm_clk_prepare_enable(&pdev->dev, clk);
         |         ^~~~~~~~~~~~~~~~~~~~~~~
         |         clk_prepare_enable
   cc1: some warnings being treated as errors

vim +923 drivers/tty/serial/sccnxp.c

   880	
   881	static int sccnxp_probe(struct platform_device *pdev)
   882	{
   883		struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
   884		struct sccnxp_pdata *pdata = dev_get_platdata(&pdev->dev);
   885		int i, ret, uartclk;
   886		struct sccnxp_port *s;
   887		void __iomem *membase;
   888		struct clk *clk;
   889	
   890		membase = devm_ioremap_resource(&pdev->dev, res);
   891		if (IS_ERR(membase))
   892			return PTR_ERR(membase);
   893	
   894		s = devm_kzalloc(&pdev->dev, sizeof(struct sccnxp_port), GFP_KERNEL);
   895		if (!s) {
   896			dev_err(&pdev->dev, "Error allocating port structure\n");
   897			return -ENOMEM;
   898		}
   899		platform_set_drvdata(pdev, s);
   900	
   901		spin_lock_init(&s->lock);
   902	
   903		s->chip = (struct sccnxp_chip *)pdev->id_entry->driver_data;
   904	
   905		s->regulator = devm_regulator_get(&pdev->dev, "vcc");
   906		if (!IS_ERR(s->regulator)) {
   907			ret = regulator_enable(s->regulator);
   908			if (ret) {
   909				dev_err(&pdev->dev,
   910					"Failed to enable regulator: %i\n", ret);
   911				return ret;
   912			}
   913		} else if (PTR_ERR(s->regulator) == -EPROBE_DEFER)
   914			return -EPROBE_DEFER;
   915	
   916		clk = devm_clk_get(&pdev->dev, NULL);
   917		if (IS_ERR(clk)) {
   918			ret = PTR_ERR(clk);
   919			if (ret == -EPROBE_DEFER)
   920				goto err_out;
   921			uartclk = 0;
   922		} else {
 > 923			ret = devm_clk_prepare_enable(&pdev->dev, clk);
   924			if (ret)
   925				goto err_out;
   926	
   927			uartclk = clk_get_rate(clk);
   928		}
   929	
   930		if (!uartclk) {
   931			dev_notice(&pdev->dev, "Using default clock frequency\n");
   932			uartclk = s->chip->freq_std;
   933		}
   934	
   935		/* Check input frequency */
   936		if ((uartclk < s->chip->freq_min) || (uartclk > s->chip->freq_max)) {
   937			dev_err(&pdev->dev, "Frequency out of bounds\n");
   938			ret = -EINVAL;
   939			goto err_out;
   940		}
   941	
   942		if (pdata)
   943			memcpy(&s->pdata, pdata, sizeof(struct sccnxp_pdata));
   944	
   945		if (s->pdata.poll_time_us) {
   946			dev_info(&pdev->dev, "Using poll mode, resolution %u usecs\n",
   947				 s->pdata.poll_time_us);
   948			s->poll = 1;
   949		}
   950	
   951		if (!s->poll) {
   952			s->irq = platform_get_irq(pdev, 0);
   953			if (s->irq < 0) {
   954				ret = -ENXIO;
   955				goto err_out;
   956			}
   957		}
   958	
   959		s->uart.owner		= THIS_MODULE;
   960		s->uart.dev_name	= "ttySC";
   961		s->uart.major		= SCCNXP_MAJOR;
   962		s->uart.minor		= SCCNXP_MINOR;
   963		s->uart.nr		= s->chip->nr;
   964	#ifdef CONFIG_SERIAL_SCCNXP_CONSOLE
   965		s->uart.cons		= &s->console;
   966		s->uart.cons->device	= uart_console_device;
   967		s->uart.cons->write	= sccnxp_console_write;
   968		s->uart.cons->setup	= sccnxp_console_setup;
   969		s->uart.cons->flags	= CON_PRINTBUFFER;
   970		s->uart.cons->index	= -1;
   971		s->uart.cons->data	= s;
   972		strcpy(s->uart.cons->name, "ttySC");
   973	#endif
   974		ret = uart_register_driver(&s->uart);
   975		if (ret) {
   976			dev_err(&pdev->dev, "Registering UART driver failed\n");
   977			goto err_out;
   978		}
   979	
   980		for (i = 0; i < s->uart.nr; i++) {
   981			s->port[i].line		= i;
   982			s->port[i].dev		= &pdev->dev;
   983			s->port[i].irq		= s->irq;
   984			s->port[i].type		= PORT_SC26XX;
   985			s->port[i].fifosize	= s->chip->fifosize;
   986			s->port[i].flags	= UPF_SKIP_TEST | UPF_FIXED_TYPE;
   987			s->port[i].iotype	= UPIO_MEM;
   988			s->port[i].mapbase	= res->start;
   989			s->port[i].membase	= membase;
   990			s->port[i].regshift	= s->pdata.reg_shift;
   991			s->port[i].uartclk	= uartclk;
   992			s->port[i].ops		= &sccnxp_ops;
   993			s->port[i].has_sysrq = IS_ENABLED(CONFIG_SERIAL_SCCNXP_CONSOLE);
   994			uart_add_one_port(&s->uart, &s->port[i]);
   995			/* Set direction to input */
   996			if (s->chip->flags & SCCNXP_HAVE_IO)
   997				sccnxp_set_bit(&s->port[i], DIR_OP, 0);
   998		}
   999	
  1000		/* Disable interrupts */
  1001		s->imr = 0;
  1002		sccnxp_write(&s->port[0], SCCNXP_IMR_REG, 0);
  1003	
  1004		if (!s->poll) {
  1005			ret = devm_request_threaded_irq(&pdev->dev, s->irq, NULL,
  1006							sccnxp_ist,
  1007							IRQF_TRIGGER_FALLING |
  1008							IRQF_ONESHOT,
  1009							dev_name(&pdev->dev), s);
  1010			if (!ret)
  1011				return 0;
  1012	
  1013			dev_err(&pdev->dev, "Unable to reguest IRQ %i\n", s->irq);
  1014		} else {
  1015			timer_setup(&s->timer, sccnxp_timer, 0);
  1016			mod_timer(&s->timer, jiffies +
  1017				  usecs_to_jiffies(s->pdata.poll_time_us));
  1018			return 0;
  1019		}
  1020	
  1021		uart_unregister_driver(&s->uart);
  1022	err_out:
  1023		if (!IS_ERR(s->regulator))
  1024			regulator_disable(s->regulator);
  1025	
  1026		return ret;
  1027	}
  1028	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email-masked]
_______________________________________________
linux-arm-kernel mailing list
[email-masked]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel