All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Conor Dooley <conor+lkp@kernel.org>
Cc: oe-kbuild-all@lists.linux.dev
Subject: [conor:gpio-no-irq-core 2/3] drivers/gpio/gpio-mpfs.c:49:45: error: duplicate member 'regs'
Date: Thu, 24 Oct 2024 07:48:11 +0800	[thread overview]
Message-ID: <202410240701.18mxAzZa-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/conor/linux.git gpio-no-irq-core
head:   56933542ce1c4bc98ea9e701609ac91333414944
commit: 2c03ad1dfd8418ab768c325b93217bb7ef70d7ce [2/3] gpio: mpfs: add CoreGPIO support
config: loongarch-randconfig-r073-20241024 (https://download.01.org/0day-ci/archive/20241024/202410240701.18mxAzZa-lkp@intel.com/config)
compiler: loongarch64-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241024/202410240701.18mxAzZa-lkp@intel.com/reproduce)

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>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410240701.18mxAzZa-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

>> drivers/gpio/gpio-mpfs.c:49:45: error: duplicate member 'regs'
      49 |         const struct mpfs_gpio_reg_offsets *regs;
         |                                             ^~~~
   drivers/gpio/gpio-mpfs.c: In function 'mpfs_gpio_direction_output':
>> drivers/gpio/gpio-mpfs.c:75:60: error: invalid use of undefined type 'struct regmap'
      75 |         regmap_update_bits(mpfs_gpio->regs, mpfs_gpio->regs->outp, BIT(gpio_index),
         |                                                            ^~
   drivers/gpio/gpio-mpfs.c: In function 'mpfs_gpio_get':
   drivers/gpio/gpio-mpfs.c:99:73: error: invalid use of undefined type 'struct regmap'
      99 |                 return regmap_test_bits(mpfs_gpio->regs, mpfs_gpio->regs->outp, BIT(gpio_index));
         |                                                                         ^~
   drivers/gpio/gpio-mpfs.c:101:73: error: invalid use of undefined type 'struct regmap'
     101 |                 return regmap_test_bits(mpfs_gpio->regs, mpfs_gpio->regs->inp, BIT(gpio_index));
         |                                                                         ^~
   drivers/gpio/gpio-mpfs.c: In function 'mpfs_gpio_set':
   drivers/gpio/gpio-mpfs.c:110:60: error: invalid use of undefined type 'struct regmap'
     110 |         regmap_update_bits(mpfs_gpio->regs, mpfs_gpio->regs->outp, BIT(gpio_index),
         |                                                            ^~
   drivers/gpio/gpio-mpfs.c: In function 'mpfs_gpio_probe':
>> drivers/gpio/gpio-mpfs.c:128:25: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     128 |         mpfs_gpio->regs = of_device_get_match_data(&pdev->dev);
         |                         ^
   drivers/gpio/gpio-mpfs.c: In function 'mpfs_gpio_get':
>> drivers/gpio/gpio-mpfs.c:102:1: warning: control reaches end of non-void function [-Wreturn-type]
     102 | }
         | ^


vim +/regs +49 drivers/gpio/gpio-mpfs.c

    45	
    46	struct mpfs_gpio_chip {
    47		struct clk *clk;
    48		struct regmap *regs;
  > 49		const struct mpfs_gpio_reg_offsets *regs;
    50		struct gpio_chip gc;
    51	};
    52	
    53	static const struct regmap_config mpfs_gpio_regmap_config = {
    54		.reg_bits = 32,
    55		.reg_stride = 4,
    56		.val_bits = 32,
    57	};
    58	
    59	static int mpfs_gpio_direction_input(struct gpio_chip *gc, unsigned int gpio_index)
    60	{
    61		struct mpfs_gpio_chip *mpfs_gpio = gpiochip_get_data(gc);
    62	
    63		regmap_update_bits(mpfs_gpio->regs, MPFS_GPIO_CTRL(gpio_index),
    64				   MPFS_GPIO_DIR_MASK, MPFS_GPIO_EN_IN);
    65	
    66		return 0;
    67	}
    68	
    69	static int mpfs_gpio_direction_output(struct gpio_chip *gc, unsigned int gpio_index, int value)
    70	{
    71		struct mpfs_gpio_chip *mpfs_gpio = gpiochip_get_data(gc);
    72	
    73		regmap_update_bits(mpfs_gpio->regs, MPFS_GPIO_CTRL(gpio_index),
    74				   MPFS_GPIO_DIR_MASK, MPFS_GPIO_EN_IN);
  > 75		regmap_update_bits(mpfs_gpio->regs, mpfs_gpio->regs->outp, BIT(gpio_index),
    76				   value << gpio_index);
    77	
    78		return 0;
    79	}
    80	
    81	static int mpfs_gpio_get_direction(struct gpio_chip *gc,
    82					   unsigned int gpio_index)
    83	{
    84		struct mpfs_gpio_chip *mpfs_gpio = gpiochip_get_data(gc);
    85		unsigned int gpio_cfg;
    86	
    87		regmap_read(mpfs_gpio->regs, MPFS_GPIO_CTRL(gpio_index), &gpio_cfg);
    88		if (gpio_cfg & MPFS_GPIO_EN_IN)
    89			return GPIO_LINE_DIRECTION_IN;
    90	
    91		return GPIO_LINE_DIRECTION_OUT;
    92	}
    93	
    94	static int mpfs_gpio_get(struct gpio_chip *gc, unsigned int gpio_index)
    95	{
    96		struct mpfs_gpio_chip *mpfs_gpio = gpiochip_get_data(gc);
    97	
    98		if (mpfs_gpio_get_direction(gc, gpio_index) == GPIO_LINE_DIRECTION_OUT)
    99			return regmap_test_bits(mpfs_gpio->regs, mpfs_gpio->regs->outp, BIT(gpio_index));
   100		else
   101			return regmap_test_bits(mpfs_gpio->regs, mpfs_gpio->regs->inp, BIT(gpio_index));
 > 102	}
   103	
   104	static void mpfs_gpio_set(struct gpio_chip *gc, unsigned int gpio_index, int value)
   105	{
   106		struct mpfs_gpio_chip *mpfs_gpio = gpiochip_get_data(gc);
   107	
   108		mpfs_gpio_get(gc, gpio_index);
   109	
   110		regmap_update_bits(mpfs_gpio->regs, mpfs_gpio->regs->outp, BIT(gpio_index),
   111				   value << gpio_index);
   112	
   113		mpfs_gpio_get(gc, gpio_index);
   114	}
   115	
   116	static int mpfs_gpio_probe(struct platform_device *pdev)
   117	{
   118		struct device *dev = &pdev->dev;
   119		struct mpfs_gpio_chip *mpfs_gpio;
   120		struct clk *clk;
   121		void __iomem *base;
   122		int ret, ngpios;
   123	
   124		mpfs_gpio = devm_kzalloc(dev, sizeof(*mpfs_gpio), GFP_KERNEL);
   125		if (!mpfs_gpio)
   126			return -ENOMEM;
   127	
 > 128		mpfs_gpio->regs = of_device_get_match_data(&pdev->dev);
   129	
   130		base = devm_platform_ioremap_resource(pdev, 0);
   131		if (IS_ERR(base))
   132			return dev_err_probe(dev, PTR_ERR(base), "failed to ioremap memory resource\n");
   133	
   134		mpfs_gpio->regs = devm_regmap_init_mmio(dev, base, &mpfs_gpio_regmap_config);
   135		if (IS_ERR(mpfs_gpio->regs))
   136			return dev_err_probe(dev, PTR_ERR(mpfs_gpio->regs), "failed to initialise regmap\n");
   137	
   138		clk = devm_clk_get_enabled(dev, NULL);
   139		if (IS_ERR(clk))
   140			return dev_err_probe(dev, PTR_ERR(clk), "failed to get and enable clock\n");
   141	
   142		mpfs_gpio->clk = clk;
   143	
   144		ngpios = MAX_NUM_GPIO;
   145		device_property_read_u32(dev, "ngpios", &ngpios);
   146		if (ngpios > MAX_NUM_GPIO)
   147			ngpios = MAX_NUM_GPIO;
   148	
   149		mpfs_gpio->gc.direction_input = mpfs_gpio_direction_input;
   150		mpfs_gpio->gc.direction_output = mpfs_gpio_direction_output;
   151		mpfs_gpio->gc.get_direction = mpfs_gpio_get_direction;
   152		mpfs_gpio->gc.get = mpfs_gpio_get;
   153		mpfs_gpio->gc.set = mpfs_gpio_set;
   154		mpfs_gpio->gc.base = -1;
   155		mpfs_gpio->gc.ngpio = ngpios;
   156		mpfs_gpio->gc.label = dev_name(dev);
   157		mpfs_gpio->gc.parent = dev;
   158		mpfs_gpio->gc.owner = THIS_MODULE;
   159	
   160		ret = gpiochip_add_data(&mpfs_gpio->gc, mpfs_gpio);
   161		if (ret)
   162			return ret;
   163	
   164		platform_set_drvdata(pdev, mpfs_gpio);
   165	
   166		return 0;
   167	}
   168	

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

                 reply	other threads:[~2024-10-23 23:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202410240701.18mxAzZa-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=conor+lkp@kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.