public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: "Martin Zaťovič" <m.zatovic1@gmail.com>, linux-kernel@vger.kernel.org
Cc: oe-kbuild-all@lists.linux.dev, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, gregkh@linuxfoundation.org,
	airlied@redhat.com, dipenp@nvidia.com, treding@nvidia.com,
	mwen@igalia.com, fmdefrancesco@gmail.com, arnd@arndb.de,
	bvanassche@acm.org, ogabbay@kernel.org, axboe@kernel.dk,
	mathieu.poirier@linaro.org, linux@zary.sk, masahiroy@kernel.org,
	yangyicong@hisilicon.com, dan.j.williams@intel.com,
	jacek.lawrynowicz@linux.intel.com, benjamin.tissoires@redhat.com,
	devicetree@vger.kernel.org, furong.zhou@linux.intel.com,
	andriy.shevchenko@intel.com, linus.walleij@linaro.org,
	"Martin Zaťovič" <m.zatovic1@gmail.com>
Subject: Re: [PATCHv3 4/4] wiegand: add Wiegand GPIO bitbanged controller driver
Date: Thu, 2 Mar 2023 10:11:58 +0800	[thread overview]
Message-ID: <202303020937.pxOPT5nt-lkp@intel.com> (raw)
In-Reply-To: <20230301142835.19614-5-m.zatovic1@gmail.com>

Hi Martin,

I love your patch! Perhaps something to improve:

[auto build test WARNING on robh/for-next]
[also build test WARNING on linus/master v6.2 next-20230301]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Martin-Za-ovi/dt-bindings-wiegand-add-Wiegand-controller-common-properties/20230301-223030
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
patch link:    https://lore.kernel.org/r/20230301142835.19614-5-m.zatovic1%40gmail.com
patch subject: [PATCHv3 4/4] wiegand: add Wiegand GPIO bitbanged controller driver
config: sh-allmodconfig (https://download.01.org/0day-ci/archive/20230302/202303020937.pxOPT5nt-lkp@intel.com/config)
compiler: sh4-linux-gcc (GCC) 12.1.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://github.com/intel-lab-lkp/linux/commit/641c36b9878a19ea4977f0e14df22c7475b423df
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Martin-Za-ovi/dt-bindings-wiegand-add-Wiegand-controller-common-properties/20230301-223030
        git checkout 641c36b9878a19ea4977f0e14df22c7475b423df
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sh olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sh SHELL=/bin/bash drivers/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202303020937.pxOPT5nt-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/wiegand/wiegand-gpio.c:50:9: warning: no previous prototype for 'payload_len_show' [-Wmissing-prototypes]
      50 | ssize_t payload_len_show(struct device *dev, struct device_attribute *attr, char *buf)
         |         ^~~~~~~~~~~~~~~~
>> drivers/wiegand/wiegand-gpio.c:58:9: warning: no previous prototype for 'payload_len_store' [-Wmissing-prototypes]
      58 | ssize_t payload_len_store(struct device *dev, struct device_attribute *attr, const char *buf,
         |         ^~~~~~~~~~~~~~~~~
>> drivers/wiegand/wiegand-gpio.c:81:6: warning: no previous prototype for 'wiegand_gpio_send_bit' [-Wmissing-prototypes]
      81 | void wiegand_gpio_send_bit(struct wiegand_gpio *wiegand_gpio, bool value, bool last)
         |      ^~~~~~~~~~~~~~~~~~~~~
>> drivers/wiegand/wiegand-gpio.c:195:5: warning: no previous prototype for 'wiegand_gpio_transfer_message' [-Wmissing-prototypes]
     195 | int wiegand_gpio_transfer_message(struct wiegand_device *dev, u8 *message, u8 msg_bitlen)
         |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +/payload_len_show +50 drivers/wiegand/wiegand-gpio.c

    46	
    47	/*
    48	 * Attribute file for setting payload length of Wiegand messages.
    49	 */
  > 50	ssize_t payload_len_show(struct device *dev, struct device_attribute *attr, char *buf)
    51	{
    52		struct wiegand_gpio *wiegand_gpio = dev_get_drvdata(dev);
    53		struct wiegand_controller *ctlr = wiegand_gpio->ctlr;
    54	
    55		return sysfs_emit(buf, "%u\n", ctlr->payload_len);
    56	}
    57	
  > 58	ssize_t payload_len_store(struct device *dev, struct device_attribute *attr, const char *buf,
    59				size_t count)
    60	{
    61		struct wiegand_gpio *wiegand_gpio = dev_get_drvdata(dev);
    62		struct wiegand_controller *ctlr = wiegand_gpio->ctlr;
    63	
    64		return store_ulong(&(ctlr->payload_len), buf, count, WIEGAND_MAX_PAYLEN_BYTES * 8);
    65	}
    66	DEVICE_ATTR_RW(payload_len);
    67	
    68	static struct attribute *wiegand_gpio_attrs[] = {
    69		&dev_attr_payload_len.attr,
    70		NULL,
    71	};
    72	
    73	ATTRIBUTE_GROUPS(wiegand_gpio);
    74	
    75	/*
    76	 * To send a bit of value 1 following the wiegand protocol, one must set
    77	 * the wiegand_data_hi to low for the duration of pulse. Similarly to send
    78	 * a bit of value 0, the wiegand_data_lo is set to low for pulse duration.
    79	 * This way the two lines are never low at the same time.
    80	 */
  > 81	void wiegand_gpio_send_bit(struct wiegand_gpio *wiegand_gpio, bool value, bool last)
    82	{
    83		u32 pulse_len = wiegand_gpio->ctlr->pulse_len;
    84		u32 interval_len = wiegand_gpio->ctlr->interval_len;
    85		u32 frame_gap = wiegand_gpio->ctlr->frame_gap;
    86		struct gpio_desc *gpio = value ? wiegand_gpio->gpio_data_hi : wiegand_gpio->gpio_data_lo;
    87	
    88		gpiod_set_value_cansleep(gpio, 0);
    89		udelay(pulse_len);
    90		gpiod_set_value_cansleep(gpio, 1);
    91	
    92		if (last)
    93			udelay(frame_gap - pulse_len);
    94		else
    95			udelay(interval_len - pulse_len);
    96	}
    97	
    98	/* This function is used for writing from file in dev directory */
    99	static int wiegand_gpio_write_by_bits(struct wiegand_gpio *wiegand_gpio, u16 bitlen)
   100	{
   101		size_t i;
   102		bool bit_value, is_last_bit;
   103	
   104		for (i = 0; i < bitlen; i++) {
   105			bit_value = ((wiegand_gpio->data[i / 8] >> (7 - (i % 8))) & 0x01);
   106			is_last_bit = (i + 1) == bitlen;
   107			wiegand_gpio_send_bit(wiegand_gpio, bit_value, is_last_bit);
   108		}
   109	
   110		return 0;
   111	}
   112	
   113	static ssize_t wiegand_gpio_get_user_data(struct wiegand_gpio *wiegand_gpio, char __user const *buf,
   114						  size_t len)
   115	{
   116		size_t rc;
   117	
   118		if (len > WIEGAND_MAX_PAYLEN_BYTES)
   119			return -EBADMSG;
   120	
   121		rc = copy_from_user(&wiegand_gpio->data[0], buf, WIEGAND_MAX_PAYLEN_BYTES);
   122		if (rc < 0)
   123			return rc;
   124	
   125		return len;
   126	}
   127	
   128	static int wiegand_gpio_frelease(struct inode *ino, struct file *filp)
   129	{
   130		struct wiegand_gpio_instance *info = filp->private_data;
   131		struct wiegand_gpio *wiegand_gpio = info->dev;
   132	
   133		mutex_lock(&wiegand_gpio->mutex);
   134		info->flags = 0;
   135		mutex_unlock(&wiegand_gpio->mutex);
   136	
   137		kfree(info);
   138	
   139		return 0;
   140	}
   141	
   142	static ssize_t wiegand_gpio_fwrite(struct file *filp, char __user const *buf, size_t len,
   143					loff_t *offset)
   144	{
   145		struct wiegand_gpio_instance *info = filp->private_data;
   146		struct wiegand_gpio *wiegand_gpio = info->dev;
   147		u32 msg_length = wiegand_gpio->ctlr->payload_len;
   148		int rc;
   149	
   150		if (buf == NULL || len == 0 || len * 8 < msg_length)
   151			return -EINVAL;
   152	
   153		rc = wiegand_gpio_get_user_data(wiegand_gpio, buf, len);
   154		if (rc < 0)
   155			return rc;
   156	
   157		wiegand_gpio_write_by_bits(wiegand_gpio, msg_length);
   158	
   159		return len;
   160	}
   161	
   162	static int wiegand_gpio_fopen(struct inode *ino, struct file *filp)
   163	{
   164		int rc;
   165		struct wiegand_gpio_instance *info;
   166		struct wiegand_gpio *wiegand_gpio = container_of(filp->f_op, struct wiegand_gpio, fops);
   167	
   168		mutex_lock(&wiegand_gpio->mutex);
   169	
   170		if ((filp->f_flags & O_ACCMODE) == O_RDONLY || (filp->f_flags & O_ACCMODE) == O_RDWR) {
   171			dev_err(wiegand_gpio->dev, "Device is write only\n");
   172			rc = -EIO;
   173			goto err;
   174		}
   175	
   176		info = kzalloc(sizeof(*info), GFP_KERNEL);
   177		if (!info) {
   178			rc = -ENOMEM;
   179			goto err;
   180		}
   181	
   182		info->dev = wiegand_gpio;
   183		info->flags = filp->f_flags;
   184		mutex_unlock(&wiegand_gpio->mutex);
   185	
   186		filp->private_data = info;
   187	
   188		return 0;
   189	err:
   190		mutex_unlock(&wiegand_gpio->mutex);
   191		return rc;
   192	}
   193	
   194	/* This function is used by device drivers */
 > 195	int wiegand_gpio_transfer_message(struct wiegand_device *dev, u8 *message, u8 msg_bitlen)
   196	{
   197		struct wiegand_controller *ctlr = dev->controller;
   198		struct wiegand_gpio *wiegand_gpio = wiegand_master_get_devdata(ctlr);
   199		u8 msg_bytelength = (msg_bitlen % 8) ? (msg_bitlen / 8) + 1 : (msg_bitlen / 8);
   200	
   201		memcpy(wiegand_gpio->data, message, msg_bytelength);
   202		wiegand_gpio_write_by_bits(wiegand_gpio, msg_bitlen);
   203	
   204		return 0;
   205	}
   206	

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

  parent reply	other threads:[~2023-03-02  2:13 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-01 14:28 [PATCHv3 0/4] Wiegand bus driver and GPIO bitbanged controller Martin Zaťovič
2023-03-01 14:28 ` [PATCHv3 1/4] dt-bindings: wiegand: add Wiegand controller common properties Martin Zaťovič
2023-03-03 19:32   ` Rob Herring
2023-03-01 14:28 ` [PATCHv3 2/4] wiegand: add Wiegand bus driver Martin Zaťovič
2023-03-01 16:23   ` Andy Shevchenko
2023-03-01 16:48     ` Andy Shevchenko
2023-04-04 13:13     ` Martin Zaťovič
2023-04-04 20:30       ` Linus Walleij
2023-04-05  8:39         ` Andy Shevchenko
2023-03-01 22:53   ` kernel test robot
     [not found]     ` <CAPGNi97oc+tSrt-NF4KZhcEyUfZTo4PT0ms8zYSFVEyzOBq4ZA@mail.gmail.com>
2023-03-14 15:15       ` Andy Shevchenko
2023-03-01 14:28 ` [PATCHv3 3/4] dt-bindings: wiegand: add GPIO bitbanged Wiegand controller Martin Zaťovič
2023-03-12 10:34   ` Evgeny Boger
2023-03-01 14:28 ` [PATCHv3 4/4] wiegand: add Wiegand GPIO bitbanged controller driver Martin Zaťovič
2023-03-01 16:43   ` Andy Shevchenko
2023-03-02  2:11   ` kernel test robot [this message]
2023-03-12 10:32   ` Evgeny Boger
2023-03-01 16:43 ` [PATCHv3 0/4] Wiegand bus driver and GPIO bitbanged controller Andy Shevchenko
2023-03-12 10:19 ` Evgeny Boger

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=202303020937.pxOPT5nt-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=airlied@redhat.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=arnd@arndb.de \
    --cc=axboe@kernel.dk \
    --cc=benjamin.tissoires@redhat.com \
    --cc=bvanassche@acm.org \
    --cc=dan.j.williams@intel.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dipenp@nvidia.com \
    --cc=fmdefrancesco@gmail.com \
    --cc=furong.zhou@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jacek.lawrynowicz@linux.intel.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@zary.sk \
    --cc=m.zatovic1@gmail.com \
    --cc=masahiroy@kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=mwen@igalia.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=ogabbay@kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=treding@nvidia.com \
    --cc=yangyicong@hisilicon.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox