All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] mailbox: stm32-ipcc: add COMPILE_TEST dependency
@ 2020-10-24 13:31 Martin Kaiser
  2020-10-24 13:31 ` [PATCH 2/2] mailbox: stm32-ipcc: remove duplicate error message Martin Kaiser
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Martin Kaiser @ 2020-10-24 13:31 UTC (permalink / raw)
  To: Jassi Brar, Maxime Coquelin, Alexandre Torgue, Fabien Dessenne
  Cc: linux-stm32, linux-kernel, Martin Kaiser

This allows compiling the driver on architectures where the hardware is not
available. Most other mailbox drivers support this as well.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---

I used this for testing the trivial patch that removes the duplicate error
message. Also, compiling the driver on x86_64 worked without errors.

 drivers/mailbox/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig
index 05b1009e2820..abbf5d67ffa2 100644
--- a/drivers/mailbox/Kconfig
+++ b/drivers/mailbox/Kconfig
@@ -201,7 +201,7 @@ config BCM_FLEXRM_MBOX
 
 config STM32_IPCC
 	tristate "STM32 IPCC Mailbox"
-	depends on MACH_STM32MP157
+	depends on MACH_STM32MP157 || COMPILE_TEST
 	help
 	  Mailbox implementation for STMicroelectonics STM32 family chips
 	  with hardware for Inter-Processor Communication Controller (IPCC)
-- 
2.20.1


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

* [PATCH 2/2] mailbox: stm32-ipcc: remove duplicate error message
  2020-10-24 13:31 [PATCH 1/2] mailbox: stm32-ipcc: add COMPILE_TEST dependency Martin Kaiser
@ 2020-10-24 13:31 ` Martin Kaiser
  2020-10-26  8:12   ` Fabien DESSENNE
  2020-10-30 16:07 ` [PATCH 1/2] mailbox: stm32-ipcc: add COMPILE_TEST dependency kernel test robot
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 11+ messages in thread
From: Martin Kaiser @ 2020-10-24 13:31 UTC (permalink / raw)
  To: Jassi Brar, Maxime Coquelin, Alexandre Torgue, Fabien Dessenne
  Cc: linux-stm32, linux-kernel, Martin Kaiser

platform_get_irq_byname already prints an error message if the requested irq
was not found. Don't print another message in the driver.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/mailbox/stm32-ipcc.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/mailbox/stm32-ipcc.c b/drivers/mailbox/stm32-ipcc.c
index ef966887aa15..ab8fe56af948 100644
--- a/drivers/mailbox/stm32-ipcc.c
+++ b/drivers/mailbox/stm32-ipcc.c
@@ -257,9 +257,6 @@ static int stm32_ipcc_probe(struct platform_device *pdev)
 	for (i = 0; i < IPCC_IRQ_NUM; i++) {
 		ipcc->irqs[i] = platform_get_irq_byname(pdev, irq_name[i]);
 		if (ipcc->irqs[i] < 0) {
-			if (ipcc->irqs[i] != -EPROBE_DEFER)
-				dev_err(dev, "no IRQ specified %s\n",
-					irq_name[i]);
 			ret = ipcc->irqs[i];
 			goto err_clk;
 		}
-- 
2.20.1


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

* Re: [PATCH 2/2] mailbox: stm32-ipcc: remove duplicate error message
  2020-10-24 13:31 ` [PATCH 2/2] mailbox: stm32-ipcc: remove duplicate error message Martin Kaiser
@ 2020-10-26  8:12   ` Fabien DESSENNE
  0 siblings, 0 replies; 11+ messages in thread
From: Fabien DESSENNE @ 2020-10-26  8:12 UTC (permalink / raw)
  To: Martin Kaiser, Jassi Brar, Maxime Coquelin, Alexandre TORGUE
  Cc: linux-stm32, linux-kernel

Hi Martin


Thank you for the patch

On 24/10/2020 3:31 pm, Martin Kaiser wrote:
> platform_get_irq_byname already prints an error message if the requested irq
> was not found. Don't print another message in the driver.
>
> Signed-off-by: Martin Kaiser <martin@kaiser.cx>


Reviewed-by: Fabien Dessenne <fabien.dessenne@st.com>


> ---
>   drivers/mailbox/stm32-ipcc.c | 3 ---
>   1 file changed, 3 deletions(-)
>
> diff --git a/drivers/mailbox/stm32-ipcc.c b/drivers/mailbox/stm32-ipcc.c
> index ef966887aa15..ab8fe56af948 100644
> --- a/drivers/mailbox/stm32-ipcc.c
> +++ b/drivers/mailbox/stm32-ipcc.c
> @@ -257,9 +257,6 @@ static int stm32_ipcc_probe(struct platform_device *pdev)
>   	for (i = 0; i < IPCC_IRQ_NUM; i++) {
>   		ipcc->irqs[i] = platform_get_irq_byname(pdev, irq_name[i]);
>   		if (ipcc->irqs[i] < 0) {
> -			if (ipcc->irqs[i] != -EPROBE_DEFER)
> -				dev_err(dev, "no IRQ specified %s\n",
> -					irq_name[i]);
>   			ret = ipcc->irqs[i];
>   			goto err_clk;
>   		}

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

* Re: [PATCH 1/2] mailbox: stm32-ipcc: add COMPILE_TEST dependency
  2020-10-24 13:31 [PATCH 1/2] mailbox: stm32-ipcc: add COMPILE_TEST dependency Martin Kaiser
  2020-10-24 13:31 ` [PATCH 2/2] mailbox: stm32-ipcc: remove duplicate error message Martin Kaiser
@ 2020-10-30 16:07 ` kernel test robot
  2020-11-01 15:42 ` [PATCH v2 1/3] " Martin Kaiser
  2020-11-29 18:52 ` [PATCH RESEND v2 1/3] mailbox: stm32-ipcc: add COMPILE_TEST dependency Martin Kaiser
  3 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2020-10-30 16:07 UTC (permalink / raw)
  To: Martin Kaiser, Jassi Brar, Maxime Coquelin, Alexandre Torgue,
	Fabien Dessenne
  Cc: kbuild-all, clang-built-linux, linux-stm32, linux-kernel, Martin Kaiser

[-- Attachment #1: Type: text/plain, Size: 17688 bytes --]

Hi Martin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on fujitsu-integration/mailbox-for-next]
[also build test WARNING on stm32/stm32-next linus/master linux/master v5.10-rc1 next-20201030]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Martin-Kaiser/mailbox-stm32-ipcc-add-COMPILE_TEST-dependency/20201024-220512
base:   https://git.linaro.org/landing-teams/working/fujitsu/integration.git mailbox-for-next
config: x86_64-randconfig-r023-20201030 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 772aaa602383cf82795572ebcd86b0e660f3579f)
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
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://github.com/0day-ci/linux/commit/6e22aaac25dcdd4c098c57d29363fa2c204e411e
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Martin-Kaiser/mailbox-stm32-ipcc-add-COMPILE_TEST-dependency/20201024-220512
        git checkout 6e22aaac25dcdd4c098c57d29363fa2c204e411e
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/mailbox/stm32-ipcc.c:147:22: warning: cast to smaller integer type 'unsigned int' from 'void *' [-Wvoid-pointer-to-int-cast]
           unsigned int chan = (unsigned int)link->con_priv;
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/mailbox/stm32-ipcc.c:166:22: warning: cast to smaller integer type 'unsigned int' from 'void *' [-Wvoid-pointer-to-int-cast]
           unsigned int chan = (unsigned int)link->con_priv;
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/mailbox/stm32-ipcc.c:186:22: warning: cast to smaller integer type 'unsigned int' from 'void *' [-Wvoid-pointer-to-int-cast]
           unsigned int chan = (unsigned int)link->con_priv;
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/mailbox/stm32-ipcc.c:310:40: warning: cast to 'void *' from smaller integer type 'unsigned int' [-Wint-to-void-pointer-cast]
                   ipcc->controller.chans[i].con_priv = (void *)i;
                                                        ^~~~~~~~~
   4 warnings generated.

vim +147 drivers/mailbox/stm32-ipcc.c

ffbded7dee97563 Fabien Dessenne  2018-05-31  144  
ffbded7dee97563 Fabien Dessenne  2018-05-31  145  static int stm32_ipcc_send_data(struct mbox_chan *link, void *data)
ffbded7dee97563 Fabien Dessenne  2018-05-31  146  {
ffbded7dee97563 Fabien Dessenne  2018-05-31 @147  	unsigned int chan = (unsigned int)link->con_priv;
ffbded7dee97563 Fabien Dessenne  2018-05-31  148  	struct stm32_ipcc *ipcc = container_of(link->mbox, struct stm32_ipcc,
ffbded7dee97563 Fabien Dessenne  2018-05-31  149  					       controller);
ffbded7dee97563 Fabien Dessenne  2018-05-31  150  
ffbded7dee97563 Fabien Dessenne  2018-05-31  151  	dev_dbg(ipcc->controller.dev, "%s: chan:%d\n", __func__, chan);
ffbded7dee97563 Fabien Dessenne  2018-05-31  152  
ffbded7dee97563 Fabien Dessenne  2018-05-31  153  	/* set channel n occupied */
dba9a3dfe912dc4 Arnaud Pouliquen 2019-05-22  154  	stm32_ipcc_set_bits(&ipcc->lock, ipcc->reg_proc + IPCC_XSCR,
dba9a3dfe912dc4 Arnaud Pouliquen 2019-05-22  155  			    TX_BIT_CHAN(chan));
ffbded7dee97563 Fabien Dessenne  2018-05-31  156  
ffbded7dee97563 Fabien Dessenne  2018-05-31  157  	/* unmask 'tx channel free' interrupt */
dba9a3dfe912dc4 Arnaud Pouliquen 2019-05-22  158  	stm32_ipcc_clr_bits(&ipcc->lock, ipcc->reg_proc + IPCC_XMR,
dba9a3dfe912dc4 Arnaud Pouliquen 2019-05-22  159  			    TX_BIT_CHAN(chan));
ffbded7dee97563 Fabien Dessenne  2018-05-31  160  
ffbded7dee97563 Fabien Dessenne  2018-05-31  161  	return 0;
ffbded7dee97563 Fabien Dessenne  2018-05-31  162  }
ffbded7dee97563 Fabien Dessenne  2018-05-31  163  
ffbded7dee97563 Fabien Dessenne  2018-05-31  164  static int stm32_ipcc_startup(struct mbox_chan *link)
ffbded7dee97563 Fabien Dessenne  2018-05-31  165  {
ffbded7dee97563 Fabien Dessenne  2018-05-31  166  	unsigned int chan = (unsigned int)link->con_priv;
ffbded7dee97563 Fabien Dessenne  2018-05-31  167  	struct stm32_ipcc *ipcc = container_of(link->mbox, struct stm32_ipcc,
ffbded7dee97563 Fabien Dessenne  2018-05-31  168  					       controller);
ffbded7dee97563 Fabien Dessenne  2018-05-31  169  	int ret;
ffbded7dee97563 Fabien Dessenne  2018-05-31  170  
ffbded7dee97563 Fabien Dessenne  2018-05-31  171  	ret = clk_prepare_enable(ipcc->clk);
ffbded7dee97563 Fabien Dessenne  2018-05-31  172  	if (ret) {
ffbded7dee97563 Fabien Dessenne  2018-05-31  173  		dev_err(ipcc->controller.dev, "can not enable the clock\n");
ffbded7dee97563 Fabien Dessenne  2018-05-31  174  		return ret;
ffbded7dee97563 Fabien Dessenne  2018-05-31  175  	}
ffbded7dee97563 Fabien Dessenne  2018-05-31  176  
ffbded7dee97563 Fabien Dessenne  2018-05-31  177  	/* unmask 'rx channel occupied' interrupt */
dba9a3dfe912dc4 Arnaud Pouliquen 2019-05-22  178  	stm32_ipcc_clr_bits(&ipcc->lock, ipcc->reg_proc + IPCC_XMR,
dba9a3dfe912dc4 Arnaud Pouliquen 2019-05-22  179  			    RX_BIT_CHAN(chan));
ffbded7dee97563 Fabien Dessenne  2018-05-31  180  
ffbded7dee97563 Fabien Dessenne  2018-05-31  181  	return 0;
ffbded7dee97563 Fabien Dessenne  2018-05-31  182  }
ffbded7dee97563 Fabien Dessenne  2018-05-31  183  
ffbded7dee97563 Fabien Dessenne  2018-05-31  184  static void stm32_ipcc_shutdown(struct mbox_chan *link)
ffbded7dee97563 Fabien Dessenne  2018-05-31  185  {
ffbded7dee97563 Fabien Dessenne  2018-05-31  186  	unsigned int chan = (unsigned int)link->con_priv;
ffbded7dee97563 Fabien Dessenne  2018-05-31  187  	struct stm32_ipcc *ipcc = container_of(link->mbox, struct stm32_ipcc,
ffbded7dee97563 Fabien Dessenne  2018-05-31  188  					       controller);
ffbded7dee97563 Fabien Dessenne  2018-05-31  189  
ffbded7dee97563 Fabien Dessenne  2018-05-31  190  	/* mask rx/tx interrupt */
dba9a3dfe912dc4 Arnaud Pouliquen 2019-05-22  191  	stm32_ipcc_set_bits(&ipcc->lock, ipcc->reg_proc + IPCC_XMR,
ffbded7dee97563 Fabien Dessenne  2018-05-31  192  			    RX_BIT_CHAN(chan) | TX_BIT_CHAN(chan));
ffbded7dee97563 Fabien Dessenne  2018-05-31  193  
ffbded7dee97563 Fabien Dessenne  2018-05-31  194  	clk_disable_unprepare(ipcc->clk);
ffbded7dee97563 Fabien Dessenne  2018-05-31  195  }
ffbded7dee97563 Fabien Dessenne  2018-05-31  196  
ffbded7dee97563 Fabien Dessenne  2018-05-31  197  static const struct mbox_chan_ops stm32_ipcc_ops = {
ffbded7dee97563 Fabien Dessenne  2018-05-31  198  	.send_data	= stm32_ipcc_send_data,
ffbded7dee97563 Fabien Dessenne  2018-05-31  199  	.startup	= stm32_ipcc_startup,
ffbded7dee97563 Fabien Dessenne  2018-05-31  200  	.shutdown	= stm32_ipcc_shutdown,
ffbded7dee97563 Fabien Dessenne  2018-05-31  201  };
ffbded7dee97563 Fabien Dessenne  2018-05-31  202  
ffbded7dee97563 Fabien Dessenne  2018-05-31  203  static int stm32_ipcc_probe(struct platform_device *pdev)
ffbded7dee97563 Fabien Dessenne  2018-05-31  204  {
ffbded7dee97563 Fabien Dessenne  2018-05-31  205  	struct device *dev = &pdev->dev;
ffbded7dee97563 Fabien Dessenne  2018-05-31  206  	struct device_node *np = dev->of_node;
ffbded7dee97563 Fabien Dessenne  2018-05-31  207  	struct stm32_ipcc *ipcc;
ffbded7dee97563 Fabien Dessenne  2018-05-31  208  	struct resource *res;
ffbded7dee97563 Fabien Dessenne  2018-05-31  209  	unsigned int i;
ffbded7dee97563 Fabien Dessenne  2018-05-31  210  	int ret;
ffbded7dee97563 Fabien Dessenne  2018-05-31  211  	u32 ip_ver;
ffbded7dee97563 Fabien Dessenne  2018-05-31  212  	static const char * const irq_name[] = {"rx", "tx"};
ffbded7dee97563 Fabien Dessenne  2018-05-31  213  	irq_handler_t irq_thread[] = {stm32_ipcc_rx_irq, stm32_ipcc_tx_irq};
ffbded7dee97563 Fabien Dessenne  2018-05-31  214  
ffbded7dee97563 Fabien Dessenne  2018-05-31  215  	if (!np) {
ffbded7dee97563 Fabien Dessenne  2018-05-31  216  		dev_err(dev, "No DT found\n");
ffbded7dee97563 Fabien Dessenne  2018-05-31  217  		return -ENODEV;
ffbded7dee97563 Fabien Dessenne  2018-05-31  218  	}
ffbded7dee97563 Fabien Dessenne  2018-05-31  219  
ffbded7dee97563 Fabien Dessenne  2018-05-31  220  	ipcc = devm_kzalloc(dev, sizeof(*ipcc), GFP_KERNEL);
ffbded7dee97563 Fabien Dessenne  2018-05-31  221  	if (!ipcc)
ffbded7dee97563 Fabien Dessenne  2018-05-31  222  		return -ENOMEM;
ffbded7dee97563 Fabien Dessenne  2018-05-31  223  
dba9a3dfe912dc4 Arnaud Pouliquen 2019-05-22  224  	spin_lock_init(&ipcc->lock);
dba9a3dfe912dc4 Arnaud Pouliquen 2019-05-22  225  
ffbded7dee97563 Fabien Dessenne  2018-05-31  226  	/* proc_id */
ffbded7dee97563 Fabien Dessenne  2018-05-31  227  	if (of_property_read_u32(np, "st,proc-id", &ipcc->proc_id)) {
ffbded7dee97563 Fabien Dessenne  2018-05-31  228  		dev_err(dev, "Missing st,proc-id\n");
ffbded7dee97563 Fabien Dessenne  2018-05-31  229  		return -ENODEV;
ffbded7dee97563 Fabien Dessenne  2018-05-31  230  	}
ffbded7dee97563 Fabien Dessenne  2018-05-31  231  
ffbded7dee97563 Fabien Dessenne  2018-05-31  232  	if (ipcc->proc_id >= STM32_MAX_PROCS) {
ffbded7dee97563 Fabien Dessenne  2018-05-31  233  		dev_err(dev, "Invalid proc_id (%d)\n", ipcc->proc_id);
ffbded7dee97563 Fabien Dessenne  2018-05-31  234  		return -EINVAL;
ffbded7dee97563 Fabien Dessenne  2018-05-31  235  	}
ffbded7dee97563 Fabien Dessenne  2018-05-31  236  
ffbded7dee97563 Fabien Dessenne  2018-05-31  237  	/* regs */
ffbded7dee97563 Fabien Dessenne  2018-05-31  238  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
ffbded7dee97563 Fabien Dessenne  2018-05-31  239  	ipcc->reg_base = devm_ioremap_resource(dev, res);
ffbded7dee97563 Fabien Dessenne  2018-05-31  240  	if (IS_ERR(ipcc->reg_base))
ffbded7dee97563 Fabien Dessenne  2018-05-31  241  		return PTR_ERR(ipcc->reg_base);
ffbded7dee97563 Fabien Dessenne  2018-05-31  242  
ffbded7dee97563 Fabien Dessenne  2018-05-31  243  	ipcc->reg_proc = ipcc->reg_base + ipcc->proc_id * IPCC_PROC_OFFST;
ffbded7dee97563 Fabien Dessenne  2018-05-31  244  
ffbded7dee97563 Fabien Dessenne  2018-05-31  245  	/* clock */
ffbded7dee97563 Fabien Dessenne  2018-05-31  246  	ipcc->clk = devm_clk_get(dev, NULL);
ffbded7dee97563 Fabien Dessenne  2018-05-31  247  	if (IS_ERR(ipcc->clk))
ffbded7dee97563 Fabien Dessenne  2018-05-31  248  		return PTR_ERR(ipcc->clk);
ffbded7dee97563 Fabien Dessenne  2018-05-31  249  
ffbded7dee97563 Fabien Dessenne  2018-05-31  250  	ret = clk_prepare_enable(ipcc->clk);
ffbded7dee97563 Fabien Dessenne  2018-05-31  251  	if (ret) {
ffbded7dee97563 Fabien Dessenne  2018-05-31  252  		dev_err(dev, "can not enable the clock\n");
ffbded7dee97563 Fabien Dessenne  2018-05-31  253  		return ret;
ffbded7dee97563 Fabien Dessenne  2018-05-31  254  	}
ffbded7dee97563 Fabien Dessenne  2018-05-31  255  
ffbded7dee97563 Fabien Dessenne  2018-05-31  256  	/* irq */
ffbded7dee97563 Fabien Dessenne  2018-05-31  257  	for (i = 0; i < IPCC_IRQ_NUM; i++) {
68a1c8485cf8373 Fabien Dessenne  2019-04-24  258  		ipcc->irqs[i] = platform_get_irq_byname(pdev, irq_name[i]);
ffbded7dee97563 Fabien Dessenne  2018-05-31  259  		if (ipcc->irqs[i] < 0) {
68a1c8485cf8373 Fabien Dessenne  2019-04-24  260  			if (ipcc->irqs[i] != -EPROBE_DEFER)
68a1c8485cf8373 Fabien Dessenne  2019-04-24  261  				dev_err(dev, "no IRQ specified %s\n",
68a1c8485cf8373 Fabien Dessenne  2019-04-24  262  					irq_name[i]);
ffbded7dee97563 Fabien Dessenne  2018-05-31  263  			ret = ipcc->irqs[i];
ffbded7dee97563 Fabien Dessenne  2018-05-31  264  			goto err_clk;
ffbded7dee97563 Fabien Dessenne  2018-05-31  265  		}
ffbded7dee97563 Fabien Dessenne  2018-05-31  266  
ffbded7dee97563 Fabien Dessenne  2018-05-31  267  		ret = devm_request_threaded_irq(dev, ipcc->irqs[i], NULL,
ffbded7dee97563 Fabien Dessenne  2018-05-31  268  						irq_thread[i], IRQF_ONESHOT,
ffbded7dee97563 Fabien Dessenne  2018-05-31  269  						dev_name(dev), ipcc);
ffbded7dee97563 Fabien Dessenne  2018-05-31  270  		if (ret) {
ffbded7dee97563 Fabien Dessenne  2018-05-31  271  			dev_err(dev, "failed to request irq %d (%d)\n", i, ret);
ffbded7dee97563 Fabien Dessenne  2018-05-31  272  			goto err_clk;
ffbded7dee97563 Fabien Dessenne  2018-05-31  273  		}
ffbded7dee97563 Fabien Dessenne  2018-05-31  274  	}
ffbded7dee97563 Fabien Dessenne  2018-05-31  275  
ffbded7dee97563 Fabien Dessenne  2018-05-31  276  	/* mask and enable rx/tx irq */
dba9a3dfe912dc4 Arnaud Pouliquen 2019-05-22  277  	stm32_ipcc_set_bits(&ipcc->lock, ipcc->reg_proc + IPCC_XMR,
ffbded7dee97563 Fabien Dessenne  2018-05-31  278  			    RX_BIT_MASK | TX_BIT_MASK);
dba9a3dfe912dc4 Arnaud Pouliquen 2019-05-22  279  	stm32_ipcc_set_bits(&ipcc->lock, ipcc->reg_proc + IPCC_XCR,
dba9a3dfe912dc4 Arnaud Pouliquen 2019-05-22  280  			    XCR_RXOIE | XCR_TXOIE);
ffbded7dee97563 Fabien Dessenne  2018-05-31  281  
ffbded7dee97563 Fabien Dessenne  2018-05-31  282  	/* wakeup */
ffbded7dee97563 Fabien Dessenne  2018-05-31  283  	if (of_property_read_bool(np, "wakeup-source")) {
eac36c8651210df Fabien Dessenne  2019-01-04  284  		device_set_wakeup_capable(dev, true);
69269446ccbf2b4 Fabien Dessenne  2019-10-30  285  
69269446ccbf2b4 Fabien Dessenne  2019-10-30  286  		ret = dev_pm_set_wake_irq(dev, ipcc->irqs[IPCC_IRQ_RX]);
ffbded7dee97563 Fabien Dessenne  2018-05-31  287  		if (ret) {
ffbded7dee97563 Fabien Dessenne  2018-05-31  288  			dev_err(dev, "Failed to set wake up irq\n");
ffbded7dee97563 Fabien Dessenne  2018-05-31  289  			goto err_init_wkp;
ffbded7dee97563 Fabien Dessenne  2018-05-31  290  		}
ffbded7dee97563 Fabien Dessenne  2018-05-31  291  	}
ffbded7dee97563 Fabien Dessenne  2018-05-31  292  
ffbded7dee97563 Fabien Dessenne  2018-05-31  293  	/* mailbox controller */
ffbded7dee97563 Fabien Dessenne  2018-05-31  294  	ipcc->n_chans = readl_relaxed(ipcc->reg_base + IPCC_HWCFGR);
ffbded7dee97563 Fabien Dessenne  2018-05-31  295  	ipcc->n_chans &= IPCFGR_CHAN_MASK;
ffbded7dee97563 Fabien Dessenne  2018-05-31  296  
ffbded7dee97563 Fabien Dessenne  2018-05-31  297  	ipcc->controller.dev = dev;
ffbded7dee97563 Fabien Dessenne  2018-05-31  298  	ipcc->controller.txdone_irq = true;
ffbded7dee97563 Fabien Dessenne  2018-05-31  299  	ipcc->controller.ops = &stm32_ipcc_ops;
ffbded7dee97563 Fabien Dessenne  2018-05-31  300  	ipcc->controller.num_chans = ipcc->n_chans;
ffbded7dee97563 Fabien Dessenne  2018-05-31  301  	ipcc->controller.chans = devm_kcalloc(dev, ipcc->controller.num_chans,
ffbded7dee97563 Fabien Dessenne  2018-05-31  302  					      sizeof(*ipcc->controller.chans),
ffbded7dee97563 Fabien Dessenne  2018-05-31  303  					      GFP_KERNEL);
ffbded7dee97563 Fabien Dessenne  2018-05-31  304  	if (!ipcc->controller.chans) {
ffbded7dee97563 Fabien Dessenne  2018-05-31  305  		ret = -ENOMEM;
ffbded7dee97563 Fabien Dessenne  2018-05-31  306  		goto err_irq_wkp;
ffbded7dee97563 Fabien Dessenne  2018-05-31  307  	}
ffbded7dee97563 Fabien Dessenne  2018-05-31  308  
ffbded7dee97563 Fabien Dessenne  2018-05-31  309  	for (i = 0; i < ipcc->controller.num_chans; i++)
ffbded7dee97563 Fabien Dessenne  2018-05-31 @310  		ipcc->controller.chans[i].con_priv = (void *)i;
ffbded7dee97563 Fabien Dessenne  2018-05-31  311  
368d7767b50154e Thierry Reding   2018-12-20  312  	ret = devm_mbox_controller_register(dev, &ipcc->controller);
ffbded7dee97563 Fabien Dessenne  2018-05-31  313  	if (ret)
ffbded7dee97563 Fabien Dessenne  2018-05-31  314  		goto err_irq_wkp;
ffbded7dee97563 Fabien Dessenne  2018-05-31  315  
ffbded7dee97563 Fabien Dessenne  2018-05-31  316  	platform_set_drvdata(pdev, ipcc);
ffbded7dee97563 Fabien Dessenne  2018-05-31  317  
ffbded7dee97563 Fabien Dessenne  2018-05-31  318  	ip_ver = readl_relaxed(ipcc->reg_base + IPCC_VER);
ffbded7dee97563 Fabien Dessenne  2018-05-31  319  
ffbded7dee97563 Fabien Dessenne  2018-05-31  320  	dev_info(dev, "ipcc rev:%ld.%ld enabled, %d chans, proc %d\n",
ffbded7dee97563 Fabien Dessenne  2018-05-31  321  		 FIELD_GET(VER_MAJREV_MASK, ip_ver),
ffbded7dee97563 Fabien Dessenne  2018-05-31  322  		 FIELD_GET(VER_MINREV_MASK, ip_ver),
ffbded7dee97563 Fabien Dessenne  2018-05-31  323  		 ipcc->controller.num_chans, ipcc->proc_id);
ffbded7dee97563 Fabien Dessenne  2018-05-31  324  
ffbded7dee97563 Fabien Dessenne  2018-05-31  325  	clk_disable_unprepare(ipcc->clk);
ffbded7dee97563 Fabien Dessenne  2018-05-31  326  	return 0;
ffbded7dee97563 Fabien Dessenne  2018-05-31  327  
ffbded7dee97563 Fabien Dessenne  2018-05-31  328  err_irq_wkp:
69269446ccbf2b4 Fabien Dessenne  2019-10-30  329  	if (of_property_read_bool(np, "wakeup-source"))
ffbded7dee97563 Fabien Dessenne  2018-05-31  330  		dev_pm_clear_wake_irq(dev);
ffbded7dee97563 Fabien Dessenne  2018-05-31  331  err_init_wkp:
69269446ccbf2b4 Fabien Dessenne  2019-10-30  332  	device_set_wakeup_capable(dev, false);
ffbded7dee97563 Fabien Dessenne  2018-05-31  333  err_clk:
ffbded7dee97563 Fabien Dessenne  2018-05-31  334  	clk_disable_unprepare(ipcc->clk);
ffbded7dee97563 Fabien Dessenne  2018-05-31  335  	return ret;
ffbded7dee97563 Fabien Dessenne  2018-05-31  336  }
ffbded7dee97563 Fabien Dessenne  2018-05-31  337  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 42039 bytes --]

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

* [PATCH v2 1/3] mailbox: stm32-ipcc: add COMPILE_TEST dependency
  2020-10-24 13:31 [PATCH 1/2] mailbox: stm32-ipcc: add COMPILE_TEST dependency Martin Kaiser
  2020-10-24 13:31 ` [PATCH 2/2] mailbox: stm32-ipcc: remove duplicate error message Martin Kaiser
  2020-10-30 16:07 ` [PATCH 1/2] mailbox: stm32-ipcc: add COMPILE_TEST dependency kernel test robot
@ 2020-11-01 15:42 ` Martin Kaiser
  2020-11-01 15:42   ` [PATCH v2 2/3] mailbox: stm32-ipcc: remove duplicate error message Martin Kaiser
  2020-11-01 15:42   ` [PATCH v2 3/3] mailbox: stm32-ipcc: cast void pointers to unsigned long Martin Kaiser
  2020-11-29 18:52 ` [PATCH RESEND v2 1/3] mailbox: stm32-ipcc: add COMPILE_TEST dependency Martin Kaiser
  3 siblings, 2 replies; 11+ messages in thread
From: Martin Kaiser @ 2020-11-01 15:42 UTC (permalink / raw)
  To: Jassi Brar, Maxime Coquelin, Alexandre Torgue, Fabien Dessenne
  Cc: linux-stm32, linux-kernel, Martin Kaiser

This allows compiling the driver on architectures where the hardware is not
available. Most other mailbox drivers support this as well.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Reviewed-by: Fabien Dessenne <fabien.dessenne@st.com>
---
changes in v2
- added Fabien's review tag

 drivers/mailbox/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig
index 05b1009e2820..abbf5d67ffa2 100644
--- a/drivers/mailbox/Kconfig
+++ b/drivers/mailbox/Kconfig
@@ -201,7 +201,7 @@ config BCM_FLEXRM_MBOX
 
 config STM32_IPCC
 	tristate "STM32 IPCC Mailbox"
-	depends on MACH_STM32MP157
+	depends on MACH_STM32MP157 || COMPILE_TEST
 	help
 	  Mailbox implementation for STMicroelectonics STM32 family chips
 	  with hardware for Inter-Processor Communication Controller (IPCC)
-- 
2.20.1


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

* [PATCH v2 2/3] mailbox: stm32-ipcc: remove duplicate error message
  2020-11-01 15:42 ` [PATCH v2 1/3] " Martin Kaiser
@ 2020-11-01 15:42   ` Martin Kaiser
  2020-11-01 15:42   ` [PATCH v2 3/3] mailbox: stm32-ipcc: cast void pointers to unsigned long Martin Kaiser
  1 sibling, 0 replies; 11+ messages in thread
From: Martin Kaiser @ 2020-11-01 15:42 UTC (permalink / raw)
  To: Jassi Brar, Maxime Coquelin, Alexandre Torgue, Fabien Dessenne
  Cc: linux-stm32, linux-kernel, Martin Kaiser

platform_get_irq_byname already prints an error message if the requested
irq was not found. Don't print another message in the driver.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Reviewed-by: Fabien Dessenne <fabien.dessenne@st.com>
---
changes in v2
- added Fabien's review tag
- reformatted the commit message such that lines are < 75 chars

 drivers/mailbox/stm32-ipcc.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/mailbox/stm32-ipcc.c b/drivers/mailbox/stm32-ipcc.c
index ef966887aa15..ab8fe56af948 100644
--- a/drivers/mailbox/stm32-ipcc.c
+++ b/drivers/mailbox/stm32-ipcc.c
@@ -257,9 +257,6 @@ static int stm32_ipcc_probe(struct platform_device *pdev)
 	for (i = 0; i < IPCC_IRQ_NUM; i++) {
 		ipcc->irqs[i] = platform_get_irq_byname(pdev, irq_name[i]);
 		if (ipcc->irqs[i] < 0) {
-			if (ipcc->irqs[i] != -EPROBE_DEFER)
-				dev_err(dev, "no IRQ specified %s\n",
-					irq_name[i]);
 			ret = ipcc->irqs[i];
 			goto err_clk;
 		}
-- 
2.20.1


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

* [PATCH v2 3/3] mailbox: stm32-ipcc: cast void pointers to unsigned long
  2020-11-01 15:42 ` [PATCH v2 1/3] " Martin Kaiser
  2020-11-01 15:42   ` [PATCH v2 2/3] mailbox: stm32-ipcc: remove duplicate error message Martin Kaiser
@ 2020-11-01 15:42   ` Martin Kaiser
  2020-11-02 13:11     ` Fabien DESSENNE
  1 sibling, 1 reply; 11+ messages in thread
From: Martin Kaiser @ 2020-11-01 15:42 UTC (permalink / raw)
  To: Jassi Brar, Maxime Coquelin, Alexandre Torgue, Fabien Dessenne
  Cc: linux-stm32, linux-kernel, Martin Kaiser, kernel test robot

Now that the driver can be enabled by COMPILE_TEST, we see warnings on
64bit platforms when void pointers are cast to unsigned int (and
vice versa).

warning: cast to smaller integer type 'unsigned int' from 'void *'
           unsigned int chan = (unsigned int)link->con_priv;
...
warning: cast to 'void *' from smaller integer type 'unsigned int'
           ipcc->controller.chans[i].con_priv = (void *)i;

Update these casts to use unsigned long variables, which are the same
size as pointers on all platforms.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
changes in v2
- added this patch to fix COMPILE_TEST warnings

 drivers/mailbox/stm32-ipcc.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/mailbox/stm32-ipcc.c b/drivers/mailbox/stm32-ipcc.c
index ab8fe56af948..b84e0587937c 100644
--- a/drivers/mailbox/stm32-ipcc.c
+++ b/drivers/mailbox/stm32-ipcc.c
@@ -144,11 +144,11 @@ static irqreturn_t stm32_ipcc_tx_irq(int irq, void *data)
 
 static int stm32_ipcc_send_data(struct mbox_chan *link, void *data)
 {
-	unsigned int chan = (unsigned int)link->con_priv;
+	unsigned long chan = (unsigned long)link->con_priv;
 	struct stm32_ipcc *ipcc = container_of(link->mbox, struct stm32_ipcc,
 					       controller);
 
-	dev_dbg(ipcc->controller.dev, "%s: chan:%d\n", __func__, chan);
+	dev_dbg(ipcc->controller.dev, "%s: chan:%lu\n", __func__, chan);
 
 	/* set channel n occupied */
 	stm32_ipcc_set_bits(&ipcc->lock, ipcc->reg_proc + IPCC_XSCR,
@@ -163,7 +163,7 @@ static int stm32_ipcc_send_data(struct mbox_chan *link, void *data)
 
 static int stm32_ipcc_startup(struct mbox_chan *link)
 {
-	unsigned int chan = (unsigned int)link->con_priv;
+	unsigned long chan = (unsigned long)link->con_priv;
 	struct stm32_ipcc *ipcc = container_of(link->mbox, struct stm32_ipcc,
 					       controller);
 	int ret;
@@ -183,7 +183,7 @@ static int stm32_ipcc_startup(struct mbox_chan *link)
 
 static void stm32_ipcc_shutdown(struct mbox_chan *link)
 {
-	unsigned int chan = (unsigned int)link->con_priv;
+	unsigned long chan = (unsigned long)link->con_priv;
 	struct stm32_ipcc *ipcc = container_of(link->mbox, struct stm32_ipcc,
 					       controller);
 
@@ -206,7 +206,7 @@ static int stm32_ipcc_probe(struct platform_device *pdev)
 	struct device_node *np = dev->of_node;
 	struct stm32_ipcc *ipcc;
 	struct resource *res;
-	unsigned int i;
+	unsigned long i;
 	int ret;
 	u32 ip_ver;
 	static const char * const irq_name[] = {"rx", "tx"};
@@ -265,7 +265,7 @@ static int stm32_ipcc_probe(struct platform_device *pdev)
 						irq_thread[i], IRQF_ONESHOT,
 						dev_name(dev), ipcc);
 		if (ret) {
-			dev_err(dev, "failed to request irq %d (%d)\n", i, ret);
+			dev_err(dev, "failed to request irq %lu (%d)\n", i, ret);
 			goto err_clk;
 		}
 	}
-- 
2.20.1


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

* Re: [PATCH v2 3/3] mailbox: stm32-ipcc: cast void pointers to unsigned long
  2020-11-01 15:42   ` [PATCH v2 3/3] mailbox: stm32-ipcc: cast void pointers to unsigned long Martin Kaiser
@ 2020-11-02 13:11     ` Fabien DESSENNE
  0 siblings, 0 replies; 11+ messages in thread
From: Fabien DESSENNE @ 2020-11-02 13:11 UTC (permalink / raw)
  To: Martin Kaiser, Jassi Brar, Maxime Coquelin, Alexandre TORGUE
  Cc: linux-stm32, linux-kernel, kernel test robot

Hi Martin


Thank you for the patch.


Fabien


On 01/11/2020 4:42 pm, Martin Kaiser wrote:
> Now that the driver can be enabled by COMPILE_TEST, we see warnings on
> 64bit platforms when void pointers are cast to unsigned int (and
> vice versa).
>
> warning: cast to smaller integer type 'unsigned int' from 'void *'
>             unsigned int chan = (unsigned int)link->con_priv;
> ...
> warning: cast to 'void *' from smaller integer type 'unsigned int'
>             ipcc->controller.chans[i].con_priv = (void *)i;
>
> Update these casts to use unsigned long variables, which are the same
> size as pointers on all platforms.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Martin Kaiser <martin@kaiser.cx>


Reviewed-by: Fabien Dessenne<fabien.dessenne@st.com>


> ---
> changes in v2
> - added this patch to fix COMPILE_TEST warnings
>
>   drivers/mailbox/stm32-ipcc.c | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/mailbox/stm32-ipcc.c b/drivers/mailbox/stm32-ipcc.c
> index ab8fe56af948..b84e0587937c 100644
> --- a/drivers/mailbox/stm32-ipcc.c
> +++ b/drivers/mailbox/stm32-ipcc.c
> @@ -144,11 +144,11 @@ static irqreturn_t stm32_ipcc_tx_irq(int irq, void *data)
>   
>   static int stm32_ipcc_send_data(struct mbox_chan *link, void *data)
>   {
> -	unsigned int chan = (unsigned int)link->con_priv;
> +	unsigned long chan = (unsigned long)link->con_priv;
>   	struct stm32_ipcc *ipcc = container_of(link->mbox, struct stm32_ipcc,
>   					       controller);
>   
> -	dev_dbg(ipcc->controller.dev, "%s: chan:%d\n", __func__, chan);
> +	dev_dbg(ipcc->controller.dev, "%s: chan:%lu\n", __func__, chan);
>   
>   	/* set channel n occupied */
>   	stm32_ipcc_set_bits(&ipcc->lock, ipcc->reg_proc + IPCC_XSCR,
> @@ -163,7 +163,7 @@ static int stm32_ipcc_send_data(struct mbox_chan *link, void *data)
>   
>   static int stm32_ipcc_startup(struct mbox_chan *link)
>   {
> -	unsigned int chan = (unsigned int)link->con_priv;
> +	unsigned long chan = (unsigned long)link->con_priv;
>   	struct stm32_ipcc *ipcc = container_of(link->mbox, struct stm32_ipcc,
>   					       controller);
>   	int ret;
> @@ -183,7 +183,7 @@ static int stm32_ipcc_startup(struct mbox_chan *link)
>   
>   static void stm32_ipcc_shutdown(struct mbox_chan *link)
>   {
> -	unsigned int chan = (unsigned int)link->con_priv;
> +	unsigned long chan = (unsigned long)link->con_priv;
>   	struct stm32_ipcc *ipcc = container_of(link->mbox, struct stm32_ipcc,
>   					       controller);
>   
> @@ -206,7 +206,7 @@ static int stm32_ipcc_probe(struct platform_device *pdev)
>   	struct device_node *np = dev->of_node;
>   	struct stm32_ipcc *ipcc;
>   	struct resource *res;
> -	unsigned int i;
> +	unsigned long i;
>   	int ret;
>   	u32 ip_ver;
>   	static const char * const irq_name[] = {"rx", "tx"};
> @@ -265,7 +265,7 @@ static int stm32_ipcc_probe(struct platform_device *pdev)
>   						irq_thread[i], IRQF_ONESHOT,
>   						dev_name(dev), ipcc);
>   		if (ret) {
> -			dev_err(dev, "failed to request irq %d (%d)\n", i, ret);
> +			dev_err(dev, "failed to request irq %lu (%d)\n", i, ret);
>   			goto err_clk;
>   		}
>   	}

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

* [PATCH RESEND v2 1/3] mailbox: stm32-ipcc: add COMPILE_TEST dependency
  2020-10-24 13:31 [PATCH 1/2] mailbox: stm32-ipcc: add COMPILE_TEST dependency Martin Kaiser
                   ` (2 preceding siblings ...)
  2020-11-01 15:42 ` [PATCH v2 1/3] " Martin Kaiser
@ 2020-11-29 18:52 ` Martin Kaiser
  2020-11-29 18:52   ` [PATCH RESEND v2 2/3] mailbox: stm32-ipcc: remove duplicate error message Martin Kaiser
  2020-11-29 18:52   ` [PATCH RESEND v2 3/3] mailbox: stm32-ipcc: cast void pointers to unsigned long Martin Kaiser
  3 siblings, 2 replies; 11+ messages in thread
From: Martin Kaiser @ 2020-11-29 18:52 UTC (permalink / raw)
  To: Jassi Brar, Maxime Coquelin, Alexandre Torgue, Fabien Dessenne
  Cc: linux-stm32, linux-kernel, Martin Kaiser

This allows compiling the driver on architectures where the hardware is not
available. Most other mailbox drivers support this as well.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Reviewed-by: Fabien Dessenne <fabien.dessenne@st.com>
---
changes in v2
- added Fabien's review tag

Dear all,

this has been around for some weeks now. Is there anything else you need
before these simple patches can be merged?

Thanks,
Martin

 drivers/mailbox/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig
index 05b1009e2820..abbf5d67ffa2 100644
--- a/drivers/mailbox/Kconfig
+++ b/drivers/mailbox/Kconfig
@@ -201,7 +201,7 @@ config BCM_FLEXRM_MBOX
 
 config STM32_IPCC
 	tristate "STM32 IPCC Mailbox"
-	depends on MACH_STM32MP157
+	depends on MACH_STM32MP157 || COMPILE_TEST
 	help
 	  Mailbox implementation for STMicroelectonics STM32 family chips
 	  with hardware for Inter-Processor Communication Controller (IPCC)
-- 
2.20.1


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

* [PATCH RESEND v2 2/3] mailbox: stm32-ipcc: remove duplicate error message
  2020-11-29 18:52 ` [PATCH RESEND v2 1/3] mailbox: stm32-ipcc: add COMPILE_TEST dependency Martin Kaiser
@ 2020-11-29 18:52   ` Martin Kaiser
  2020-11-29 18:52   ` [PATCH RESEND v2 3/3] mailbox: stm32-ipcc: cast void pointers to unsigned long Martin Kaiser
  1 sibling, 0 replies; 11+ messages in thread
From: Martin Kaiser @ 2020-11-29 18:52 UTC (permalink / raw)
  To: Jassi Brar, Maxime Coquelin, Alexandre Torgue, Fabien Dessenne
  Cc: linux-stm32, linux-kernel, Martin Kaiser

platform_get_irq_byname already prints an error message if the requested
irq was not found. Don't print another message in the driver.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Reviewed-by: Fabien Dessenne <fabien.dessenne@st.com>
---
changes in v2
- added Fabien's review tag
- reformatted the commit message such that lines are < 75 chars

 drivers/mailbox/stm32-ipcc.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/mailbox/stm32-ipcc.c b/drivers/mailbox/stm32-ipcc.c
index ef966887aa15..ab8fe56af948 100644
--- a/drivers/mailbox/stm32-ipcc.c
+++ b/drivers/mailbox/stm32-ipcc.c
@@ -257,9 +257,6 @@ static int stm32_ipcc_probe(struct platform_device *pdev)
 	for (i = 0; i < IPCC_IRQ_NUM; i++) {
 		ipcc->irqs[i] = platform_get_irq_byname(pdev, irq_name[i]);
 		if (ipcc->irqs[i] < 0) {
-			if (ipcc->irqs[i] != -EPROBE_DEFER)
-				dev_err(dev, "no IRQ specified %s\n",
-					irq_name[i]);
 			ret = ipcc->irqs[i];
 			goto err_clk;
 		}
-- 
2.20.1


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

* [PATCH RESEND v2 3/3] mailbox: stm32-ipcc: cast void pointers to unsigned long
  2020-11-29 18:52 ` [PATCH RESEND v2 1/3] mailbox: stm32-ipcc: add COMPILE_TEST dependency Martin Kaiser
  2020-11-29 18:52   ` [PATCH RESEND v2 2/3] mailbox: stm32-ipcc: remove duplicate error message Martin Kaiser
@ 2020-11-29 18:52   ` Martin Kaiser
  1 sibling, 0 replies; 11+ messages in thread
From: Martin Kaiser @ 2020-11-29 18:52 UTC (permalink / raw)
  To: Jassi Brar, Maxime Coquelin, Alexandre Torgue, Fabien Dessenne
  Cc: linux-stm32, linux-kernel, Martin Kaiser, kernel test robot

Now that the driver can be enabled by COMPILE_TEST, we see warnings on
64bit platforms when void pointers are cast to unsigned int (and
vice versa).

warning: cast to smaller integer type 'unsigned int' from 'void *'
           unsigned int chan = (unsigned int)link->con_priv;
...
warning: cast to 'void *' from smaller integer type 'unsigned int'
           ipcc->controller.chans[i].con_priv = (void *)i;

Update these casts to use unsigned long variables, which are the same
size as pointers on all platforms.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Reviewed-by: Fabien Dessenne <fabien.dessenne@st.com>
---
changes in v2
- added this patch to fix COMPILE_TEST warnings

 drivers/mailbox/stm32-ipcc.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/mailbox/stm32-ipcc.c b/drivers/mailbox/stm32-ipcc.c
index ab8fe56af948..b84e0587937c 100644
--- a/drivers/mailbox/stm32-ipcc.c
+++ b/drivers/mailbox/stm32-ipcc.c
@@ -144,11 +144,11 @@ static irqreturn_t stm32_ipcc_tx_irq(int irq, void *data)
 
 static int stm32_ipcc_send_data(struct mbox_chan *link, void *data)
 {
-	unsigned int chan = (unsigned int)link->con_priv;
+	unsigned long chan = (unsigned long)link->con_priv;
 	struct stm32_ipcc *ipcc = container_of(link->mbox, struct stm32_ipcc,
 					       controller);
 
-	dev_dbg(ipcc->controller.dev, "%s: chan:%d\n", __func__, chan);
+	dev_dbg(ipcc->controller.dev, "%s: chan:%lu\n", __func__, chan);
 
 	/* set channel n occupied */
 	stm32_ipcc_set_bits(&ipcc->lock, ipcc->reg_proc + IPCC_XSCR,
@@ -163,7 +163,7 @@ static int stm32_ipcc_send_data(struct mbox_chan *link, void *data)
 
 static int stm32_ipcc_startup(struct mbox_chan *link)
 {
-	unsigned int chan = (unsigned int)link->con_priv;
+	unsigned long chan = (unsigned long)link->con_priv;
 	struct stm32_ipcc *ipcc = container_of(link->mbox, struct stm32_ipcc,
 					       controller);
 	int ret;
@@ -183,7 +183,7 @@ static int stm32_ipcc_startup(struct mbox_chan *link)
 
 static void stm32_ipcc_shutdown(struct mbox_chan *link)
 {
-	unsigned int chan = (unsigned int)link->con_priv;
+	unsigned long chan = (unsigned long)link->con_priv;
 	struct stm32_ipcc *ipcc = container_of(link->mbox, struct stm32_ipcc,
 					       controller);
 
@@ -206,7 +206,7 @@ static int stm32_ipcc_probe(struct platform_device *pdev)
 	struct device_node *np = dev->of_node;
 	struct stm32_ipcc *ipcc;
 	struct resource *res;
-	unsigned int i;
+	unsigned long i;
 	int ret;
 	u32 ip_ver;
 	static const char * const irq_name[] = {"rx", "tx"};
@@ -265,7 +265,7 @@ static int stm32_ipcc_probe(struct platform_device *pdev)
 						irq_thread[i], IRQF_ONESHOT,
 						dev_name(dev), ipcc);
 		if (ret) {
-			dev_err(dev, "failed to request irq %d (%d)\n", i, ret);
+			dev_err(dev, "failed to request irq %lu (%d)\n", i, ret);
 			goto err_clk;
 		}
 	}
-- 
2.20.1


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

end of thread, other threads:[~2020-11-29 18:56 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-24 13:31 [PATCH 1/2] mailbox: stm32-ipcc: add COMPILE_TEST dependency Martin Kaiser
2020-10-24 13:31 ` [PATCH 2/2] mailbox: stm32-ipcc: remove duplicate error message Martin Kaiser
2020-10-26  8:12   ` Fabien DESSENNE
2020-10-30 16:07 ` [PATCH 1/2] mailbox: stm32-ipcc: add COMPILE_TEST dependency kernel test robot
2020-11-01 15:42 ` [PATCH v2 1/3] " Martin Kaiser
2020-11-01 15:42   ` [PATCH v2 2/3] mailbox: stm32-ipcc: remove duplicate error message Martin Kaiser
2020-11-01 15:42   ` [PATCH v2 3/3] mailbox: stm32-ipcc: cast void pointers to unsigned long Martin Kaiser
2020-11-02 13:11     ` Fabien DESSENNE
2020-11-29 18:52 ` [PATCH RESEND v2 1/3] mailbox: stm32-ipcc: add COMPILE_TEST dependency Martin Kaiser
2020-11-29 18:52   ` [PATCH RESEND v2 2/3] mailbox: stm32-ipcc: remove duplicate error message Martin Kaiser
2020-11-29 18:52   ` [PATCH RESEND v2 3/3] mailbox: stm32-ipcc: cast void pointers to unsigned long Martin Kaiser

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.