diff mbox series

[v5,6/7] refactor header includes to allow kthread.h inclusion in psi_types.h

Message ID 20190308184311.144521-7-surenb@google.com (mailing list archive)
State New, archived
Headers show
Series psi: pressure stall monitors v5 | expand

Commit Message

Suren Baghdasaryan March 8, 2019, 6:43 p.m. UTC
kthread.h can't be included in psi_types.h because it creates a circular
inclusion with kthread.h eventually including psi_types.h and complaining
on kthread structures not being defined because they are defined further
in the kthread.h. Resolve this by removing psi_types.h inclusion from the
headers included from kthread.h.

Signed-off-by: Suren Baghdasaryan <surenb@google.com>
---
 include/linux/kthread.h | 3 ++-
 include/linux/sched.h   | 1 -
 kernel/kthread.c        | 1 +
 3 files changed, 3 insertions(+), 2 deletions(-)

Comments

kernel test robot March 9, 2019, 8:49 p.m. UTC | #1
Hi Suren,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.0]
[cannot apply to next-20190306]
[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/Suren-Baghdasaryan/psi-pressure-stall-monitors-v5/20190310-024018
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 8.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
        GCC_VERSION=8.2.0 make.cross ARCH=ia64 

All errors (new ones prefixed by >>):

   drivers/spi/spi-rockchip.c: In function 'rockchip_spi_probe':
>> drivers/spi/spi-rockchip.c:649:8: error: implicit declaration of function 'devm_request_threaded_irq'; did you mean 'devm_request_region'? [-Werror=implicit-function-declaration]
     ret = devm_request_threaded_irq(&pdev->dev, ret, rockchip_spi_isr, NULL,
           ^~~~~~~~~~~~~~~~~~~~~~~~~
           devm_request_region
>> drivers/spi/spi-rockchip.c:650:4: error: 'IRQF_ONESHOT' undeclared (first use in this function); did you mean 'SA_ONESHOT'?
       IRQF_ONESHOT, dev_name(&pdev->dev), master);
       ^~~~~~~~~~~~
       SA_ONESHOT
   drivers/spi/spi-rockchip.c:650:4: note: each undeclared identifier is reported only once for each function it appears in
   cc1: some warnings being treated as errors

vim +649 drivers/spi/spi-rockchip.c

64e36824b addy ke              2014-07-01  592  
64e36824b addy ke              2014-07-01  593  static int rockchip_spi_probe(struct platform_device *pdev)
64e36824b addy ke              2014-07-01  594  {
43de979dd Jeffy Chen           2017-08-07  595  	int ret;
64e36824b addy ke              2014-07-01  596  	struct rockchip_spi *rs;
64e36824b addy ke              2014-07-01  597  	struct spi_master *master;
64e36824b addy ke              2014-07-01  598  	struct resource *mem;
76b17e6e4 Julius Werner        2015-03-26  599  	u32 rsd_nsecs;
64e36824b addy ke              2014-07-01  600  
64e36824b addy ke              2014-07-01  601  	master = spi_alloc_master(&pdev->dev, sizeof(struct rockchip_spi));
5dcc44ed9 Addy Ke              2014-07-11  602  	if (!master)
64e36824b addy ke              2014-07-01  603  		return -ENOMEM;
5dcc44ed9 Addy Ke              2014-07-11  604  
64e36824b addy ke              2014-07-01  605  	platform_set_drvdata(pdev, master);
64e36824b addy ke              2014-07-01  606  
64e36824b addy ke              2014-07-01  607  	rs = spi_master_get_devdata(master);
64e36824b addy ke              2014-07-01  608  
64e36824b addy ke              2014-07-01  609  	/* Get basic io resource and map it */
64e36824b addy ke              2014-07-01  610  	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
64e36824b addy ke              2014-07-01  611  	rs->regs = devm_ioremap_resource(&pdev->dev, mem);
64e36824b addy ke              2014-07-01  612  	if (IS_ERR(rs->regs)) {
64e36824b addy ke              2014-07-01  613  		ret =  PTR_ERR(rs->regs);
c351587e2 Jeffy Chen           2017-06-13  614  		goto err_put_master;
64e36824b addy ke              2014-07-01  615  	}
64e36824b addy ke              2014-07-01  616  
64e36824b addy ke              2014-07-01  617  	rs->apb_pclk = devm_clk_get(&pdev->dev, "apb_pclk");
64e36824b addy ke              2014-07-01  618  	if (IS_ERR(rs->apb_pclk)) {
64e36824b addy ke              2014-07-01  619  		dev_err(&pdev->dev, "Failed to get apb_pclk\n");
64e36824b addy ke              2014-07-01  620  		ret = PTR_ERR(rs->apb_pclk);
c351587e2 Jeffy Chen           2017-06-13  621  		goto err_put_master;
64e36824b addy ke              2014-07-01  622  	}
64e36824b addy ke              2014-07-01  623  
64e36824b addy ke              2014-07-01  624  	rs->spiclk = devm_clk_get(&pdev->dev, "spiclk");
64e36824b addy ke              2014-07-01  625  	if (IS_ERR(rs->spiclk)) {
64e36824b addy ke              2014-07-01  626  		dev_err(&pdev->dev, "Failed to get spi_pclk\n");
64e36824b addy ke              2014-07-01  627  		ret = PTR_ERR(rs->spiclk);
c351587e2 Jeffy Chen           2017-06-13  628  		goto err_put_master;
64e36824b addy ke              2014-07-01  629  	}
64e36824b addy ke              2014-07-01  630  
64e36824b addy ke              2014-07-01  631  	ret = clk_prepare_enable(rs->apb_pclk);
43de979dd Jeffy Chen           2017-08-07  632  	if (ret < 0) {
64e36824b addy ke              2014-07-01  633  		dev_err(&pdev->dev, "Failed to enable apb_pclk\n");
c351587e2 Jeffy Chen           2017-06-13  634  		goto err_put_master;
64e36824b addy ke              2014-07-01  635  	}
64e36824b addy ke              2014-07-01  636  
64e36824b addy ke              2014-07-01  637  	ret = clk_prepare_enable(rs->spiclk);
43de979dd Jeffy Chen           2017-08-07  638  	if (ret < 0) {
64e36824b addy ke              2014-07-01  639  		dev_err(&pdev->dev, "Failed to enable spi_clk\n");
c351587e2 Jeffy Chen           2017-06-13  640  		goto err_disable_apbclk;
64e36824b addy ke              2014-07-01  641  	}
64e36824b addy ke              2014-07-01  642  
30688e4e6 Emil Renner Berthing 2018-10-31  643  	spi_enable_chip(rs, false);
64e36824b addy ke              2014-07-01  644  
01b59ce5d Emil Renner Berthing 2018-10-31  645  	ret = platform_get_irq(pdev, 0);
01b59ce5d Emil Renner Berthing 2018-10-31  646  	if (ret < 0)
01b59ce5d Emil Renner Berthing 2018-10-31  647  		goto err_disable_spiclk;
01b59ce5d Emil Renner Berthing 2018-10-31  648  
01b59ce5d Emil Renner Berthing 2018-10-31 @649  	ret = devm_request_threaded_irq(&pdev->dev, ret, rockchip_spi_isr, NULL,
01b59ce5d Emil Renner Berthing 2018-10-31 @650  			IRQF_ONESHOT, dev_name(&pdev->dev), master);
01b59ce5d Emil Renner Berthing 2018-10-31  651  	if (ret)
01b59ce5d Emil Renner Berthing 2018-10-31  652  		goto err_disable_spiclk;
01b59ce5d Emil Renner Berthing 2018-10-31  653  
64e36824b addy ke              2014-07-01  654  	rs->dev = &pdev->dev;
420b82f84 Emil Renner Berthing 2018-10-31  655  	rs->freq = clk_get_rate(rs->spiclk);
64e36824b addy ke              2014-07-01  656  
76b17e6e4 Julius Werner        2015-03-26  657  	if (!of_property_read_u32(pdev->dev.of_node, "rx-sample-delay-ns",
74b7efa82 Emil Renner Berthing 2018-10-31  658  				  &rsd_nsecs)) {
74b7efa82 Emil Renner Berthing 2018-10-31  659  		/* rx sample delay is expressed in parent clock cycles (max 3) */
74b7efa82 Emil Renner Berthing 2018-10-31  660  		u32 rsd = DIV_ROUND_CLOSEST(rsd_nsecs * (rs->freq >> 8),
74b7efa82 Emil Renner Berthing 2018-10-31  661  				1000000000 >> 8);
74b7efa82 Emil Renner Berthing 2018-10-31  662  		if (!rsd) {
74b7efa82 Emil Renner Berthing 2018-10-31  663  			dev_warn(rs->dev, "%u Hz are too slow to express %u ns delay\n",
74b7efa82 Emil Renner Berthing 2018-10-31  664  					rs->freq, rsd_nsecs);
74b7efa82 Emil Renner Berthing 2018-10-31  665  		} else if (rsd > CR0_RSD_MAX) {
74b7efa82 Emil Renner Berthing 2018-10-31  666  			rsd = CR0_RSD_MAX;
74b7efa82 Emil Renner Berthing 2018-10-31  667  			dev_warn(rs->dev, "%u Hz are too fast to express %u ns delay, clamping at %u ns\n",
74b7efa82 Emil Renner Berthing 2018-10-31  668  					rs->freq, rsd_nsecs,
74b7efa82 Emil Renner Berthing 2018-10-31  669  					CR0_RSD_MAX * 1000000000U / rs->freq);
74b7efa82 Emil Renner Berthing 2018-10-31  670  		}
74b7efa82 Emil Renner Berthing 2018-10-31  671  		rs->rsd = rsd;
74b7efa82 Emil Renner Berthing 2018-10-31  672  	}
76b17e6e4 Julius Werner        2015-03-26  673  
64e36824b addy ke              2014-07-01  674  	rs->fifo_len = get_fifo_len(rs);
64e36824b addy ke              2014-07-01  675  	if (!rs->fifo_len) {
64e36824b addy ke              2014-07-01  676  		dev_err(&pdev->dev, "Failed to get fifo length\n");
db7e8d90c Wei Yongjun          2014-07-20  677  		ret = -EINVAL;
c351587e2 Jeffy Chen           2017-06-13  678  		goto err_disable_spiclk;
64e36824b addy ke              2014-07-01  679  	}
64e36824b addy ke              2014-07-01  680  
64e36824b addy ke              2014-07-01  681  	pm_runtime_set_active(&pdev->dev);
64e36824b addy ke              2014-07-01  682  	pm_runtime_enable(&pdev->dev);
64e36824b addy ke              2014-07-01  683  
64e36824b addy ke              2014-07-01  684  	master->auto_runtime_pm = true;
64e36824b addy ke              2014-07-01  685  	master->bus_num = pdev->id;
04290192f Emil Renner Berthing 2018-10-31  686  	master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LOOP | SPI_LSB_FIRST;
aa099382a Jeffy Chen           2017-06-28  687  	master->num_chipselect = ROCKCHIP_SPI_MAX_CS_NUM;
64e36824b addy ke              2014-07-01  688  	master->dev.of_node = pdev->dev.of_node;
65498c6ae Emil Renner Berthing 2018-10-31  689  	master->bits_per_word_mask = SPI_BPW_MASK(16) | SPI_BPW_MASK(8) | SPI_BPW_MASK(4);
420b82f84 Emil Renner Berthing 2018-10-31  690  	master->min_speed_hz = rs->freq / BAUDR_SCKDV_MAX;
420b82f84 Emil Renner Berthing 2018-10-31  691  	master->max_speed_hz = min(rs->freq / BAUDR_SCKDV_MIN, MAX_SCLK_OUT);
64e36824b addy ke              2014-07-01  692  
64e36824b addy ke              2014-07-01  693  	master->set_cs = rockchip_spi_set_cs;
64e36824b addy ke              2014-07-01  694  	master->transfer_one = rockchip_spi_transfer_one;
5185a81c0 Brian Norris         2016-07-14  695  	master->max_transfer_size = rockchip_spi_max_transfer_size;
2291793cc Andy Shevchenko      2015-02-27  696  	master->handle_err = rockchip_spi_handle_err;
c863795c4 Jeffy Chen           2017-06-28  697  	master->flags = SPI_MASTER_GPIO_SS;
64e36824b addy ke              2014-07-01  698  
eee06a9ee Emil Renner Berthing 2018-10-31  699  	master->dma_tx = dma_request_chan(rs->dev, "tx");
eee06a9ee Emil Renner Berthing 2018-10-31  700  	if (IS_ERR(master->dma_tx)) {
61cadcf46 Shawn Lin            2016-03-09  701  		/* Check tx to see if we need defer probing driver */
eee06a9ee Emil Renner Berthing 2018-10-31  702  		if (PTR_ERR(master->dma_tx) == -EPROBE_DEFER) {
61cadcf46 Shawn Lin            2016-03-09  703  			ret = -EPROBE_DEFER;
c351587e2 Jeffy Chen           2017-06-13  704  			goto err_disable_pm_runtime;
61cadcf46 Shawn Lin            2016-03-09  705  		}
64e36824b addy ke              2014-07-01  706  		dev_warn(rs->dev, "Failed to request TX DMA channel\n");
eee06a9ee Emil Renner Berthing 2018-10-31  707  		master->dma_tx = NULL;
61cadcf46 Shawn Lin            2016-03-09  708  	}
64e36824b addy ke              2014-07-01  709  
eee06a9ee Emil Renner Berthing 2018-10-31  710  	master->dma_rx = dma_request_chan(rs->dev, "rx");
eee06a9ee Emil Renner Berthing 2018-10-31  711  	if (IS_ERR(master->dma_rx)) {
eee06a9ee Emil Renner Berthing 2018-10-31  712  		if (PTR_ERR(master->dma_rx) == -EPROBE_DEFER) {
e4c0e06f9 Shawn Lin            2016-03-31  713  			ret = -EPROBE_DEFER;
5de7ed0c9 Dan Carpenter        2016-05-04  714  			goto err_free_dma_tx;
64e36824b addy ke              2014-07-01  715  		}
64e36824b addy ke              2014-07-01  716  		dev_warn(rs->dev, "Failed to request RX DMA channel\n");
eee06a9ee Emil Renner Berthing 2018-10-31  717  		master->dma_rx = NULL;
64e36824b addy ke              2014-07-01  718  	}
64e36824b addy ke              2014-07-01  719  
eee06a9ee Emil Renner Berthing 2018-10-31  720  	if (master->dma_tx && master->dma_rx) {
eee06a9ee Emil Renner Berthing 2018-10-31  721  		rs->dma_addr_tx = mem->start + ROCKCHIP_SPI_TXDR;
eee06a9ee Emil Renner Berthing 2018-10-31  722  		rs->dma_addr_rx = mem->start + ROCKCHIP_SPI_RXDR;
64e36824b addy ke              2014-07-01  723  		master->can_dma = rockchip_spi_can_dma;
64e36824b addy ke              2014-07-01  724  	}
64e36824b addy ke              2014-07-01  725  
64e36824b addy ke              2014-07-01  726  	ret = devm_spi_register_master(&pdev->dev, master);
43de979dd Jeffy Chen           2017-08-07  727  	if (ret < 0) {
64e36824b addy ke              2014-07-01  728  		dev_err(&pdev->dev, "Failed to register master\n");
c351587e2 Jeffy Chen           2017-06-13  729  		goto err_free_dma_rx;
64e36824b addy ke              2014-07-01  730  	}
64e36824b addy ke              2014-07-01  731  
64e36824b addy ke              2014-07-01  732  	return 0;
64e36824b addy ke              2014-07-01  733  
c351587e2 Jeffy Chen           2017-06-13  734  err_free_dma_rx:
eee06a9ee Emil Renner Berthing 2018-10-31  735  	if (master->dma_rx)
eee06a9ee Emil Renner Berthing 2018-10-31  736  		dma_release_channel(master->dma_rx);
5de7ed0c9 Dan Carpenter        2016-05-04  737  err_free_dma_tx:
eee06a9ee Emil Renner Berthing 2018-10-31  738  	if (master->dma_tx)
eee06a9ee Emil Renner Berthing 2018-10-31  739  		dma_release_channel(master->dma_tx);
c351587e2 Jeffy Chen           2017-06-13  740  err_disable_pm_runtime:
c351587e2 Jeffy Chen           2017-06-13  741  	pm_runtime_disable(&pdev->dev);
c351587e2 Jeffy Chen           2017-06-13  742  err_disable_spiclk:
64e36824b addy ke              2014-07-01  743  	clk_disable_unprepare(rs->spiclk);
c351587e2 Jeffy Chen           2017-06-13  744  err_disable_apbclk:
64e36824b addy ke              2014-07-01  745  	clk_disable_unprepare(rs->apb_pclk);
c351587e2 Jeffy Chen           2017-06-13  746  err_put_master:
64e36824b addy ke              2014-07-01  747  	spi_master_put(master);
64e36824b addy ke              2014-07-01  748  
64e36824b addy ke              2014-07-01  749  	return ret;
64e36824b addy ke              2014-07-01  750  }
64e36824b addy ke              2014-07-01  751  

:::::: The code at line 649 was first introduced by commit
:::::: 01b59ce5dac856323a0c13c1d51d99a819f32efe spi: rockchip: use irq rather than polling

:::::: TO: Emil Renner Berthing <kernel@esmil.dk>
:::::: CC: Mark Brown <broonie@kernel.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot March 9, 2019, 11:12 p.m. UTC | #2
Hi Suren,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.0]
[cannot apply to next-20190306]
[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/Suren-Baghdasaryan/psi-pressure-stall-monitors-v5/20190310-024018
config: i386-randconfig-a0-201910 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/spi/spi-rockchip.c:328:8: error: unknown type name 'irqreturn_t'
    static irqreturn_t rockchip_spi_isr(int irq, void *dev_id)
           ^
   drivers/spi/spi-rockchip.c: In function 'rockchip_spi_isr':
   drivers/spi/spi-rockchip.c:343:9: error: 'IRQ_HANDLED' undeclared (first use in this function)
     return IRQ_HANDLED;
            ^
   drivers/spi/spi-rockchip.c:343:9: note: each undeclared identifier is reported only once for each function it appears in
   drivers/spi/spi-rockchip.c: In function 'rockchip_spi_probe':
>> drivers/spi/spi-rockchip.c:649:2: error: implicit declaration of function 'devm_request_threaded_irq' [-Werror=implicit-function-declaration]
     ret = devm_request_threaded_irq(&pdev->dev, ret, rockchip_spi_isr, NULL,
     ^
   drivers/spi/spi-rockchip.c:650:4: error: 'IRQF_ONESHOT' undeclared (first use in this function)
       IRQF_ONESHOT, dev_name(&pdev->dev), master);
       ^
   cc1: some warnings being treated as errors

vim +/devm_request_threaded_irq +649 drivers/spi/spi-rockchip.c

64e36824b addy ke              2014-07-01  592  
64e36824b addy ke              2014-07-01  593  static int rockchip_spi_probe(struct platform_device *pdev)
64e36824b addy ke              2014-07-01  594  {
43de979dd Jeffy Chen           2017-08-07  595  	int ret;
64e36824b addy ke              2014-07-01  596  	struct rockchip_spi *rs;
64e36824b addy ke              2014-07-01  597  	struct spi_master *master;
64e36824b addy ke              2014-07-01  598  	struct resource *mem;
76b17e6e4 Julius Werner        2015-03-26  599  	u32 rsd_nsecs;
64e36824b addy ke              2014-07-01  600  
64e36824b addy ke              2014-07-01  601  	master = spi_alloc_master(&pdev->dev, sizeof(struct rockchip_spi));
5dcc44ed9 Addy Ke              2014-07-11  602  	if (!master)
64e36824b addy ke              2014-07-01  603  		return -ENOMEM;
5dcc44ed9 Addy Ke              2014-07-11  604  
64e36824b addy ke              2014-07-01  605  	platform_set_drvdata(pdev, master);
64e36824b addy ke              2014-07-01  606  
64e36824b addy ke              2014-07-01  607  	rs = spi_master_get_devdata(master);
64e36824b addy ke              2014-07-01  608  
64e36824b addy ke              2014-07-01  609  	/* Get basic io resource and map it */
64e36824b addy ke              2014-07-01  610  	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
64e36824b addy ke              2014-07-01  611  	rs->regs = devm_ioremap_resource(&pdev->dev, mem);
64e36824b addy ke              2014-07-01  612  	if (IS_ERR(rs->regs)) {
64e36824b addy ke              2014-07-01  613  		ret =  PTR_ERR(rs->regs);
c351587e2 Jeffy Chen           2017-06-13  614  		goto err_put_master;
64e36824b addy ke              2014-07-01  615  	}
64e36824b addy ke              2014-07-01  616  
64e36824b addy ke              2014-07-01  617  	rs->apb_pclk = devm_clk_get(&pdev->dev, "apb_pclk");
64e36824b addy ke              2014-07-01  618  	if (IS_ERR(rs->apb_pclk)) {
64e36824b addy ke              2014-07-01  619  		dev_err(&pdev->dev, "Failed to get apb_pclk\n");
64e36824b addy ke              2014-07-01  620  		ret = PTR_ERR(rs->apb_pclk);
c351587e2 Jeffy Chen           2017-06-13  621  		goto err_put_master;
64e36824b addy ke              2014-07-01  622  	}
64e36824b addy ke              2014-07-01  623  
64e36824b addy ke              2014-07-01  624  	rs->spiclk = devm_clk_get(&pdev->dev, "spiclk");
64e36824b addy ke              2014-07-01  625  	if (IS_ERR(rs->spiclk)) {
64e36824b addy ke              2014-07-01  626  		dev_err(&pdev->dev, "Failed to get spi_pclk\n");
64e36824b addy ke              2014-07-01  627  		ret = PTR_ERR(rs->spiclk);
c351587e2 Jeffy Chen           2017-06-13  628  		goto err_put_master;
64e36824b addy ke              2014-07-01  629  	}
64e36824b addy ke              2014-07-01  630  
64e36824b addy ke              2014-07-01  631  	ret = clk_prepare_enable(rs->apb_pclk);
43de979dd Jeffy Chen           2017-08-07  632  	if (ret < 0) {
64e36824b addy ke              2014-07-01  633  		dev_err(&pdev->dev, "Failed to enable apb_pclk\n");
c351587e2 Jeffy Chen           2017-06-13  634  		goto err_put_master;
64e36824b addy ke              2014-07-01  635  	}
64e36824b addy ke              2014-07-01  636  
64e36824b addy ke              2014-07-01  637  	ret = clk_prepare_enable(rs->spiclk);
43de979dd Jeffy Chen           2017-08-07  638  	if (ret < 0) {
64e36824b addy ke              2014-07-01  639  		dev_err(&pdev->dev, "Failed to enable spi_clk\n");
c351587e2 Jeffy Chen           2017-06-13  640  		goto err_disable_apbclk;
64e36824b addy ke              2014-07-01  641  	}
64e36824b addy ke              2014-07-01  642  
30688e4e6 Emil Renner Berthing 2018-10-31  643  	spi_enable_chip(rs, false);
64e36824b addy ke              2014-07-01  644  
01b59ce5d Emil Renner Berthing 2018-10-31  645  	ret = platform_get_irq(pdev, 0);
01b59ce5d Emil Renner Berthing 2018-10-31  646  	if (ret < 0)
01b59ce5d Emil Renner Berthing 2018-10-31  647  		goto err_disable_spiclk;
01b59ce5d Emil Renner Berthing 2018-10-31  648  
01b59ce5d Emil Renner Berthing 2018-10-31 @649  	ret = devm_request_threaded_irq(&pdev->dev, ret, rockchip_spi_isr, NULL,
01b59ce5d Emil Renner Berthing 2018-10-31  650  			IRQF_ONESHOT, dev_name(&pdev->dev), master);
01b59ce5d Emil Renner Berthing 2018-10-31  651  	if (ret)
01b59ce5d Emil Renner Berthing 2018-10-31  652  		goto err_disable_spiclk;
01b59ce5d Emil Renner Berthing 2018-10-31  653  
64e36824b addy ke              2014-07-01  654  	rs->dev = &pdev->dev;
420b82f84 Emil Renner Berthing 2018-10-31  655  	rs->freq = clk_get_rate(rs->spiclk);
64e36824b addy ke              2014-07-01  656  
76b17e6e4 Julius Werner        2015-03-26  657  	if (!of_property_read_u32(pdev->dev.of_node, "rx-sample-delay-ns",
74b7efa82 Emil Renner Berthing 2018-10-31  658  				  &rsd_nsecs)) {
74b7efa82 Emil Renner Berthing 2018-10-31  659  		/* rx sample delay is expressed in parent clock cycles (max 3) */
74b7efa82 Emil Renner Berthing 2018-10-31  660  		u32 rsd = DIV_ROUND_CLOSEST(rsd_nsecs * (rs->freq >> 8),
74b7efa82 Emil Renner Berthing 2018-10-31  661  				1000000000 >> 8);
74b7efa82 Emil Renner Berthing 2018-10-31  662  		if (!rsd) {
74b7efa82 Emil Renner Berthing 2018-10-31  663  			dev_warn(rs->dev, "%u Hz are too slow to express %u ns delay\n",
74b7efa82 Emil Renner Berthing 2018-10-31  664  					rs->freq, rsd_nsecs);
74b7efa82 Emil Renner Berthing 2018-10-31  665  		} else if (rsd > CR0_RSD_MAX) {
74b7efa82 Emil Renner Berthing 2018-10-31  666  			rsd = CR0_RSD_MAX;
74b7efa82 Emil Renner Berthing 2018-10-31  667  			dev_warn(rs->dev, "%u Hz are too fast to express %u ns delay, clamping at %u ns\n",
74b7efa82 Emil Renner Berthing 2018-10-31  668  					rs->freq, rsd_nsecs,
74b7efa82 Emil Renner Berthing 2018-10-31  669  					CR0_RSD_MAX * 1000000000U / rs->freq);
74b7efa82 Emil Renner Berthing 2018-10-31  670  		}
74b7efa82 Emil Renner Berthing 2018-10-31  671  		rs->rsd = rsd;
74b7efa82 Emil Renner Berthing 2018-10-31  672  	}
76b17e6e4 Julius Werner        2015-03-26  673  
64e36824b addy ke              2014-07-01  674  	rs->fifo_len = get_fifo_len(rs);
64e36824b addy ke              2014-07-01  675  	if (!rs->fifo_len) {
64e36824b addy ke              2014-07-01  676  		dev_err(&pdev->dev, "Failed to get fifo length\n");
db7e8d90c Wei Yongjun          2014-07-20  677  		ret = -EINVAL;
c351587e2 Jeffy Chen           2017-06-13  678  		goto err_disable_spiclk;
64e36824b addy ke              2014-07-01  679  	}
64e36824b addy ke              2014-07-01  680  
64e36824b addy ke              2014-07-01  681  	pm_runtime_set_active(&pdev->dev);
64e36824b addy ke              2014-07-01  682  	pm_runtime_enable(&pdev->dev);
64e36824b addy ke              2014-07-01  683  
64e36824b addy ke              2014-07-01  684  	master->auto_runtime_pm = true;
64e36824b addy ke              2014-07-01  685  	master->bus_num = pdev->id;
04290192f Emil Renner Berthing 2018-10-31  686  	master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LOOP | SPI_LSB_FIRST;
aa099382a Jeffy Chen           2017-06-28  687  	master->num_chipselect = ROCKCHIP_SPI_MAX_CS_NUM;
64e36824b addy ke              2014-07-01  688  	master->dev.of_node = pdev->dev.of_node;
65498c6ae Emil Renner Berthing 2018-10-31  689  	master->bits_per_word_mask = SPI_BPW_MASK(16) | SPI_BPW_MASK(8) | SPI_BPW_MASK(4);
420b82f84 Emil Renner Berthing 2018-10-31  690  	master->min_speed_hz = rs->freq / BAUDR_SCKDV_MAX;
420b82f84 Emil Renner Berthing 2018-10-31  691  	master->max_speed_hz = min(rs->freq / BAUDR_SCKDV_MIN, MAX_SCLK_OUT);
64e36824b addy ke              2014-07-01  692  
64e36824b addy ke              2014-07-01  693  	master->set_cs = rockchip_spi_set_cs;
64e36824b addy ke              2014-07-01  694  	master->transfer_one = rockchip_spi_transfer_one;
5185a81c0 Brian Norris         2016-07-14  695  	master->max_transfer_size = rockchip_spi_max_transfer_size;
2291793cc Andy Shevchenko      2015-02-27  696  	master->handle_err = rockchip_spi_handle_err;
c863795c4 Jeffy Chen           2017-06-28  697  	master->flags = SPI_MASTER_GPIO_SS;
64e36824b addy ke              2014-07-01  698  
eee06a9ee Emil Renner Berthing 2018-10-31  699  	master->dma_tx = dma_request_chan(rs->dev, "tx");
eee06a9ee Emil Renner Berthing 2018-10-31  700  	if (IS_ERR(master->dma_tx)) {
61cadcf46 Shawn Lin            2016-03-09  701  		/* Check tx to see if we need defer probing driver */
eee06a9ee Emil Renner Berthing 2018-10-31  702  		if (PTR_ERR(master->dma_tx) == -EPROBE_DEFER) {
61cadcf46 Shawn Lin            2016-03-09  703  			ret = -EPROBE_DEFER;
c351587e2 Jeffy Chen           2017-06-13  704  			goto err_disable_pm_runtime;
61cadcf46 Shawn Lin            2016-03-09  705  		}
64e36824b addy ke              2014-07-01  706  		dev_warn(rs->dev, "Failed to request TX DMA channel\n");
eee06a9ee Emil Renner Berthing 2018-10-31  707  		master->dma_tx = NULL;
61cadcf46 Shawn Lin            2016-03-09  708  	}
64e36824b addy ke              2014-07-01  709  
eee06a9ee Emil Renner Berthing 2018-10-31  710  	master->dma_rx = dma_request_chan(rs->dev, "rx");
eee06a9ee Emil Renner Berthing 2018-10-31  711  	if (IS_ERR(master->dma_rx)) {
eee06a9ee Emil Renner Berthing 2018-10-31  712  		if (PTR_ERR(master->dma_rx) == -EPROBE_DEFER) {
e4c0e06f9 Shawn Lin            2016-03-31  713  			ret = -EPROBE_DEFER;
5de7ed0c9 Dan Carpenter        2016-05-04  714  			goto err_free_dma_tx;
64e36824b addy ke              2014-07-01  715  		}
64e36824b addy ke              2014-07-01  716  		dev_warn(rs->dev, "Failed to request RX DMA channel\n");
eee06a9ee Emil Renner Berthing 2018-10-31  717  		master->dma_rx = NULL;
64e36824b addy ke              2014-07-01  718  	}
64e36824b addy ke              2014-07-01  719  
eee06a9ee Emil Renner Berthing 2018-10-31  720  	if (master->dma_tx && master->dma_rx) {
eee06a9ee Emil Renner Berthing 2018-10-31  721  		rs->dma_addr_tx = mem->start + ROCKCHIP_SPI_TXDR;
eee06a9ee Emil Renner Berthing 2018-10-31  722  		rs->dma_addr_rx = mem->start + ROCKCHIP_SPI_RXDR;
64e36824b addy ke              2014-07-01  723  		master->can_dma = rockchip_spi_can_dma;
64e36824b addy ke              2014-07-01  724  	}
64e36824b addy ke              2014-07-01  725  
64e36824b addy ke              2014-07-01  726  	ret = devm_spi_register_master(&pdev->dev, master);
43de979dd Jeffy Chen           2017-08-07  727  	if (ret < 0) {
64e36824b addy ke              2014-07-01  728  		dev_err(&pdev->dev, "Failed to register master\n");
c351587e2 Jeffy Chen           2017-06-13  729  		goto err_free_dma_rx;
64e36824b addy ke              2014-07-01  730  	}
64e36824b addy ke              2014-07-01  731  
64e36824b addy ke              2014-07-01  732  	return 0;
64e36824b addy ke              2014-07-01  733  
c351587e2 Jeffy Chen           2017-06-13  734  err_free_dma_rx:
eee06a9ee Emil Renner Berthing 2018-10-31  735  	if (master->dma_rx)
eee06a9ee Emil Renner Berthing 2018-10-31  736  		dma_release_channel(master->dma_rx);
5de7ed0c9 Dan Carpenter        2016-05-04  737  err_free_dma_tx:
eee06a9ee Emil Renner Berthing 2018-10-31  738  	if (master->dma_tx)
eee06a9ee Emil Renner Berthing 2018-10-31  739  		dma_release_channel(master->dma_tx);
c351587e2 Jeffy Chen           2017-06-13  740  err_disable_pm_runtime:
c351587e2 Jeffy Chen           2017-06-13  741  	pm_runtime_disable(&pdev->dev);
c351587e2 Jeffy Chen           2017-06-13  742  err_disable_spiclk:
64e36824b addy ke              2014-07-01  743  	clk_disable_unprepare(rs->spiclk);
c351587e2 Jeffy Chen           2017-06-13  744  err_disable_apbclk:
64e36824b addy ke              2014-07-01  745  	clk_disable_unprepare(rs->apb_pclk);
c351587e2 Jeffy Chen           2017-06-13  746  err_put_master:
64e36824b addy ke              2014-07-01  747  	spi_master_put(master);
64e36824b addy ke              2014-07-01  748  
64e36824b addy ke              2014-07-01  749  	return ret;
64e36824b addy ke              2014-07-01  750  }
64e36824b addy ke              2014-07-01  751  

:::::: The code at line 649 was first introduced by commit
:::::: 01b59ce5dac856323a0c13c1d51d99a819f32efe spi: rockchip: use irq rather than polling

:::::: TO: Emil Renner Berthing <kernel@esmil.dk>
:::::: CC: Mark Brown <broonie@kernel.org>

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

Patch

diff --git a/include/linux/kthread.h b/include/linux/kthread.h
index 2c89e60bc752..0f9da966934e 100644
--- a/include/linux/kthread.h
+++ b/include/linux/kthread.h
@@ -4,7 +4,6 @@ 
 /* Simple interface for creating and stopping kernel threads without mess. */
 #include <linux/err.h>
 #include <linux/sched.h>
-#include <linux/cgroup.h>
 
 __printf(4, 5)
 struct task_struct *kthread_create_on_node(int (*threadfn)(void *data),
@@ -198,6 +197,8 @@  bool kthread_cancel_delayed_work_sync(struct kthread_delayed_work *work);
 
 void kthread_destroy_worker(struct kthread_worker *worker);
 
+struct cgroup_subsys_state;
+
 #ifdef CONFIG_BLK_CGROUP
 void kthread_associate_blkcg(struct cgroup_subsys_state *css);
 struct cgroup_subsys_state *kthread_blkcg(void);
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 1549584a1538..20b9f03399a7 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -26,7 +26,6 @@ 
 #include <linux/latencytop.h>
 #include <linux/sched/prio.h>
 #include <linux/signal_types.h>
-#include <linux/psi_types.h>
 #include <linux/mm_types_task.h>
 #include <linux/task_io_accounting.h>
 #include <linux/rseq.h>
diff --git a/kernel/kthread.c b/kernel/kthread.c
index 5942eeafb9ac..be4e8795561a 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -11,6 +11,7 @@ 
 #include <linux/kthread.h>
 #include <linux/completion.h>
 #include <linux/err.h>
+#include <linux/cgroup.h>
 #include <linux/cpuset.h>
 #include <linux/unistd.h>
 #include <linux/file.h>