All of lore.kernel.org
 help / color / mirror / Atom feed
* [tglx-devel:irqflags 13/20] drivers/gpio/gpio-mpsse.c:468 gpio_mpsse_poll() warn: mixing irqsave and irq
@ 2026-08-30 10:14 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-08-30 10:14 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Thomas Gleixner <tglx@kernel.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git irqflags
head:   59394501f5a285ef270931207a67d2f129403151
commit: 882d92b84f9618f000a4de66daeee48df6d81357 [13/20] irqflags: Cleanup wrappers
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: i386-randconfig-141-20260830 (https://download.01.org/0day-ci/archive/20260830/202608301846.WnjLAtgu-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
smatch: v0.5.0-9187-g5189e3fb

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202608301846.WnjLAtgu-lkp@intel.com/

New smatch warnings:
drivers/gpio/gpio-mpsse.c:468 gpio_mpsse_poll() warn: mixing irqsave and irq
drivers/cpufreq/speedstep-smi.c:180 speedstep_set_state() warn: mixing irqsave and irq
kernel/rcu/rcutorture.c:2302 rcutorture_one_extend() warn: mixing irq and irqsave

Old smatch warnings:
include/linux/mutex.h:254 class_mutex_try_constructor() warn: passing zero to 'ERR_PTR'

vim +468 drivers/gpio/gpio-mpsse.c

179ef1127d7a4f Mary Strodl 2025-10-14  397  
179ef1127d7a4f Mary Strodl 2025-10-14  398  static void gpio_mpsse_poll(struct work_struct *my_work)
c46a74ff05c0ac Mary Strodl 2024-10-09  399  {
c46a74ff05c0ac Mary Strodl 2024-10-09  400  	unsigned long pin_mask, pin_states, flags;
c46a74ff05c0ac Mary Strodl 2024-10-09  401  	int irq_enabled, offset, err, value, fire_irq,
c46a74ff05c0ac Mary Strodl 2024-10-09  402  		irq, old_value[16], irq_type[16];
179ef1127d7a4f Mary Strodl 2025-10-14  403  	struct mpsse_worker *my_worker = container_of(my_work, struct mpsse_worker, work);
179ef1127d7a4f Mary Strodl 2025-10-14  404  	struct mpsse_priv *priv = my_worker->priv;
c46a74ff05c0ac Mary Strodl 2024-10-09  405  
c46a74ff05c0ac Mary Strodl 2024-10-09  406  	for (offset = 0; offset < priv->gpio.ngpio; ++offset)
c46a74ff05c0ac Mary Strodl 2024-10-09  407  		old_value[offset] = -1;
c46a74ff05c0ac Mary Strodl 2024-10-09  408  
179ef1127d7a4f Mary Strodl 2025-10-14  409  	/*
179ef1127d7a4f Mary Strodl 2025-10-14  410  	 * We only want one worker. Workers race to acquire irq_race and tear
179ef1127d7a4f Mary Strodl 2025-10-14  411  	 * down all other workers. This is a cond guard so that we don't deadlock
179ef1127d7a4f Mary Strodl 2025-10-14  412  	 * trying to cancel a worker.
179ef1127d7a4f Mary Strodl 2025-10-14  413  	 */
179ef1127d7a4f Mary Strodl 2025-10-14  414  	scoped_cond_guard(mutex_try, return, &priv->irq_race)
179ef1127d7a4f Mary Strodl 2025-10-14  415  		gpio_mpsse_stop_all_except(priv, my_worker);
179ef1127d7a4f Mary Strodl 2025-10-14  416  
179ef1127d7a4f Mary Strodl 2025-10-14  417  	while ((irq_enabled = atomic_read(&priv->irq_enabled)) &&
179ef1127d7a4f Mary Strodl 2025-10-14  418  	       !atomic_read(&my_worker->cancelled)) {
c46a74ff05c0ac Mary Strodl 2024-10-09  419  		usleep_range(MPSSE_POLL_INTERVAL, MPSSE_POLL_INTERVAL + 1000);
c46a74ff05c0ac Mary Strodl 2024-10-09  420  		/* Cleanup will trigger at the end of the loop */
c46a74ff05c0ac Mary Strodl 2024-10-09  421  		guard(mutex)(&priv->irq_mutex);
c46a74ff05c0ac Mary Strodl 2024-10-09  422  
c46a74ff05c0ac Mary Strodl 2024-10-09  423  		pin_mask = 0;
c46a74ff05c0ac Mary Strodl 2024-10-09  424  		pin_states = 0;
c46a74ff05c0ac Mary Strodl 2024-10-09  425  		for (offset = 0; offset < priv->gpio.ngpio; ++offset) {
c46a74ff05c0ac Mary Strodl 2024-10-09  426  			irq_type[offset] = atomic_read(&priv->irq_type[offset]);
c46a74ff05c0ac Mary Strodl 2024-10-09  427  			if (irq_type[offset] != IRQ_TYPE_NONE &&
c46a74ff05c0ac Mary Strodl 2024-10-09  428  			    irq_enabled & BIT(offset))
c46a74ff05c0ac Mary Strodl 2024-10-09  429  				pin_mask |= BIT(offset);
c46a74ff05c0ac Mary Strodl 2024-10-09  430  			else
c46a74ff05c0ac Mary Strodl 2024-10-09  431  				old_value[offset] = -1;
c46a74ff05c0ac Mary Strodl 2024-10-09  432  		}
c46a74ff05c0ac Mary Strodl 2024-10-09  433  
c46a74ff05c0ac Mary Strodl 2024-10-09  434  		err = gpio_mpsse_get_multiple(&priv->gpio, &pin_mask,
c46a74ff05c0ac Mary Strodl 2024-10-09  435  					      &pin_states);
c46a74ff05c0ac Mary Strodl 2024-10-09  436  		if (err) {
c46a74ff05c0ac Mary Strodl 2024-10-09  437  			dev_err_ratelimited(&priv->intf->dev,
c46a74ff05c0ac Mary Strodl 2024-10-09  438  					    "Error polling!\n");
c46a74ff05c0ac Mary Strodl 2024-10-09  439  			continue;
c46a74ff05c0ac Mary Strodl 2024-10-09  440  		}
c46a74ff05c0ac Mary Strodl 2024-10-09  441  
c46a74ff05c0ac Mary Strodl 2024-10-09  442  		/* Check each value */
c46a74ff05c0ac Mary Strodl 2024-10-09  443  		for (offset = 0; offset < priv->gpio.ngpio; ++offset) {
c46a74ff05c0ac Mary Strodl 2024-10-09  444  			if (old_value[offset] == -1)
c46a74ff05c0ac Mary Strodl 2024-10-09  445  				continue;
c46a74ff05c0ac Mary Strodl 2024-10-09  446  
c46a74ff05c0ac Mary Strodl 2024-10-09  447  			fire_irq = 0;
c46a74ff05c0ac Mary Strodl 2024-10-09  448  			value = pin_states & BIT(offset);
c46a74ff05c0ac Mary Strodl 2024-10-09  449  
c46a74ff05c0ac Mary Strodl 2024-10-09  450  			switch (irq_type[offset]) {
c46a74ff05c0ac Mary Strodl 2024-10-09  451  			case IRQ_TYPE_EDGE_RISING:
c46a74ff05c0ac Mary Strodl 2024-10-09  452  				fire_irq = value > old_value[offset];
c46a74ff05c0ac Mary Strodl 2024-10-09  453  				break;
c46a74ff05c0ac Mary Strodl 2024-10-09  454  			case IRQ_TYPE_EDGE_FALLING:
c46a74ff05c0ac Mary Strodl 2024-10-09  455  				fire_irq = value < old_value[offset];
c46a74ff05c0ac Mary Strodl 2024-10-09  456  				break;
c46a74ff05c0ac Mary Strodl 2024-10-09  457  			case IRQ_TYPE_EDGE_BOTH:
c46a74ff05c0ac Mary Strodl 2024-10-09  458  				fire_irq = value != old_value[offset];
c46a74ff05c0ac Mary Strodl 2024-10-09  459  				break;
c46a74ff05c0ac Mary Strodl 2024-10-09  460  			}
c46a74ff05c0ac Mary Strodl 2024-10-09  461  			if (!fire_irq)
c46a74ff05c0ac Mary Strodl 2024-10-09  462  				continue;
c46a74ff05c0ac Mary Strodl 2024-10-09  463  
c46a74ff05c0ac Mary Strodl 2024-10-09  464  			irq = irq_find_mapping(priv->gpio.irq.domain,
c46a74ff05c0ac Mary Strodl 2024-10-09  465  					       offset);
c46a74ff05c0ac Mary Strodl 2024-10-09  466  			local_irq_save(flags);
c46a74ff05c0ac Mary Strodl 2024-10-09  467  			generic_handle_irq(irq);
c46a74ff05c0ac Mary Strodl 2024-10-09 @468  			local_irq_disable();
c46a74ff05c0ac Mary Strodl 2024-10-09  469  			local_irq_restore(flags);
c46a74ff05c0ac Mary Strodl 2024-10-09  470  		}
c46a74ff05c0ac Mary Strodl 2024-10-09  471  
c46a74ff05c0ac Mary Strodl 2024-10-09  472  		/* Sync back values so we can refer to them next tick */
c46a74ff05c0ac Mary Strodl 2024-10-09  473  		for (offset = 0; offset < priv->gpio.ngpio; ++offset)
c46a74ff05c0ac Mary Strodl 2024-10-09  474  			if (irq_type[offset] != IRQ_TYPE_NONE &&
c46a74ff05c0ac Mary Strodl 2024-10-09  475  			    irq_enabled & BIT(offset))
c46a74ff05c0ac Mary Strodl 2024-10-09  476  				old_value[offset] = pin_states & BIT(offset);
c46a74ff05c0ac Mary Strodl 2024-10-09  477  	}
c46a74ff05c0ac Mary Strodl 2024-10-09  478  }
c46a74ff05c0ac Mary Strodl 2024-10-09  479  

:::::: The code at line 468 was first introduced by commit
:::::: c46a74ff05c0ac76ba11ef21c930c3b447abf31a gpio: add support for FTDI's MPSSE as GPIO

:::::: TO: Mary Strodl <mstrodl@csh.rit.edu>
:::::: CC: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-30 10:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-30 10:14 [tglx-devel:irqflags 13/20] drivers/gpio/gpio-mpsse.c:468 gpio_mpsse_poll() warn: mixing irqsave and irq kernel test robot

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.