Re: [PATCH 1/1] staging: greybus: Added do - while in multi statement macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Hemansh,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on staging/staging-testing]

url:    https://github.com/0day-ci/linux/commits/Hemansh-Agnihotri/staging-greybus-Added-do-while-in-multi-statement-macro/20210211-175717
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 6953026f21092199a59f2c641a880b1c4025f932
config: m68k-randconfig-r003-20210211 (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.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/0day-ci/linux/commit/e0f87bc4986d8e909dfda91664ce1700b01acb85
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Hemansh-Agnihotri/staging-greybus-Added-do-while-in-multi-statement-macro/20210211-175717
        git checkout e0f87bc4986d8e909dfda91664ce1700b01acb85
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=m68k 

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

All errors (new ones prefixed by >>):

>> drivers/staging/greybus/loopback.c:165:40: error: expected identifier or '(' before 'do'
     165 | #define gb_loopback_stats_attrs(field) do { \
         |                                        ^~
   drivers/staging/greybus/loopback.c:272:1: note: in expansion of macro 'gb_loopback_stats_attrs'
     272 | gb_loopback_stats_attrs(latency);
         | ^~~~~~~~~~~~~~~~~~~~~~~
>> drivers/staging/greybus/loopback.c:169:4: error: expected identifier or '(' before 'while'
     169 |  } while (0)
         |    ^~~~~
   drivers/staging/greybus/loopback.c:272:1: note: in expansion of macro 'gb_loopback_stats_attrs'
     272 | gb_loopback_stats_attrs(latency);
         | ^~~~~~~~~~~~~~~~~~~~~~~
>> drivers/staging/greybus/loopback.c:165:40: error: expected identifier or '(' before 'do'
     165 | #define gb_loopback_stats_attrs(field) do { \
         |                                        ^~
   drivers/staging/greybus/loopback.c:274:1: note: in expansion of macro 'gb_loopback_stats_attrs'
     274 | gb_loopback_stats_attrs(requests_per_second);
         | ^~~~~~~~~~~~~~~~~~~~~~~
>> drivers/staging/greybus/loopback.c:169:4: error: expected identifier or '(' before 'while'
     169 |  } while (0)
         |    ^~~~~
   drivers/staging/greybus/loopback.c:274:1: note: in expansion of macro 'gb_loopback_stats_attrs'
     274 | gb_loopback_stats_attrs(requests_per_second);
         | ^~~~~~~~~~~~~~~~~~~~~~~
>> drivers/staging/greybus/loopback.c:165:40: error: expected identifier or '(' before 'do'
     165 | #define gb_loopback_stats_attrs(field) do { \
         |                                        ^~
   drivers/staging/greybus/loopback.c:276:1: note: in expansion of macro 'gb_loopback_stats_attrs'
     276 | gb_loopback_stats_attrs(throughput);
         | ^~~~~~~~~~~~~~~~~~~~~~~
>> drivers/staging/greybus/loopback.c:169:4: error: expected identifier or '(' before 'while'
     169 |  } while (0)
         |    ^~~~~
   drivers/staging/greybus/loopback.c:276:1: note: in expansion of macro 'gb_loopback_stats_attrs'
     276 | gb_loopback_stats_attrs(throughput);
         | ^~~~~~~~~~~~~~~~~~~~~~~
>> drivers/staging/greybus/loopback.c:165:40: error: expected identifier or '(' before 'do'
     165 | #define gb_loopback_stats_attrs(field) do { \
         |                                        ^~
   drivers/staging/greybus/loopback.c:278:1: note: in expansion of macro 'gb_loopback_stats_attrs'
     278 | gb_loopback_stats_attrs(apbridge_unipro_latency);
         | ^~~~~~~~~~~~~~~~~~~~~~~
>> drivers/staging/greybus/loopback.c:169:4: error: expected identifier or '(' before 'while'
     169 |  } while (0)
         |    ^~~~~
   drivers/staging/greybus/loopback.c:278:1: note: in expansion of macro 'gb_loopback_stats_attrs'
     278 | gb_loopback_stats_attrs(apbridge_unipro_latency);
         | ^~~~~~~~~~~~~~~~~~~~~~~
>> drivers/staging/greybus/loopback.c:165:40: error: expected identifier or '(' before 'do'
     165 | #define gb_loopback_stats_attrs(field) do { \
         |                                        ^~
   drivers/staging/greybus/loopback.c:280:1: note: in expansion of macro 'gb_loopback_stats_attrs'
     280 | gb_loopback_stats_attrs(gbphy_firmware_latency);
         | ^~~~~~~~~~~~~~~~~~~~~~~
>> drivers/staging/greybus/loopback.c:169:4: error: expected identifier or '(' before 'while'
     169 |  } while (0)
         |    ^~~~~
   drivers/staging/greybus/loopback.c:280:1: note: in expansion of macro 'gb_loopback_stats_attrs'
     280 | gb_loopback_stats_attrs(gbphy_firmware_latency);
         | ^~~~~~~~~~~~~~~~~~~~~~~
>> drivers/staging/greybus/loopback.c:318:3: error: 'dev_attr_latency_min' undeclared here (not in a function); did you mean 'dev_attr_timeout_min'?
     318 |  &dev_attr_latency_min.attr,
         |   ^~~~~~~~~~~~~~~~~~~~
         |   dev_attr_timeout_min
>> drivers/staging/greybus/loopback.c:319:3: error: 'dev_attr_latency_max' undeclared here (not in a function); did you mean 'dev_attr_timeout_max'?
     319 |  &dev_attr_latency_max.attr,
         |   ^~~~~~~~~~~~~~~~~~~~
         |   dev_attr_timeout_max
>> drivers/staging/greybus/loopback.c:320:3: error: 'dev_attr_latency_avg' undeclared here (not in a function)
     320 |  &dev_attr_latency_avg.attr,
         |   ^~~~~~~~~~~~~~~~~~~~
>> drivers/staging/greybus/loopback.c:321:3: error: 'dev_attr_requests_per_second_min' undeclared here (not in a function)
     321 |  &dev_attr_requests_per_second_min.attr,
         |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/staging/greybus/loopback.c:322:3: error: 'dev_attr_requests_per_second_max' undeclared here (not in a function)
     322 |  &dev_attr_requests_per_second_max.attr,
         |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/staging/greybus/loopback.c:323:3: error: 'dev_attr_requests_per_second_avg' undeclared here (not in a function)
     323 |  &dev_attr_requests_per_second_avg.attr,
         |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/staging/greybus/loopback.c:324:3: error: 'dev_attr_throughput_min' undeclared here (not in a function); did you mean 'dev_attr_timeout_min'?
     324 |  &dev_attr_throughput_min.attr,
         |   ^~~~~~~~~~~~~~~~~~~~~~~
         |   dev_attr_timeout_min
>> drivers/staging/greybus/loopback.c:325:3: error: 'dev_attr_throughput_max' undeclared here (not in a function); did you mean 'dev_attr_timeout_max'?
     325 |  &dev_attr_throughput_max.attr,
         |   ^~~~~~~~~~~~~~~~~~~~~~~
         |   dev_attr_timeout_max
>> drivers/staging/greybus/loopback.c:326:3: error: 'dev_attr_throughput_avg' undeclared here (not in a function)
     326 |  &dev_attr_throughput_avg.attr,
         |   ^~~~~~~~~~~~~~~~~~~~~~~
>> drivers/staging/greybus/loopback.c:327:3: error: 'dev_attr_apbridge_unipro_latency_min' undeclared here (not in a function)
     327 |  &dev_attr_apbridge_unipro_latency_min.attr,
         |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/greybus/loopback.c:328:3: error: 'dev_attr_apbridge_unipro_latency_max' undeclared here (not in a function)
     328 |  &dev_attr_apbridge_unipro_latency_max.attr,
         |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/greybus/loopback.c:329:3: error: 'dev_attr_apbridge_unipro_latency_avg' undeclared here (not in a function)
     329 |  &dev_attr_apbridge_unipro_latency_avg.attr,
         |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/greybus/loopback.c:330:3: error: 'dev_attr_gbphy_firmware_latency_min' undeclared here (not in a function)
     330 |  &dev_attr_gbphy_firmware_latency_min.attr,
         |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/greybus/loopback.c:331:3: error: 'dev_attr_gbphy_firmware_latency_max' undeclared here (not in a function)
     331 |  &dev_attr_gbphy_firmware_latency_max.attr,
         |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/greybus/loopback.c:332:3: error: 'dev_attr_gbphy_firmware_latency_avg' undeclared here (not in a function)
     332 |  &dev_attr_gbphy_firmware_latency_avg.attr,
         |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +165 drivers/staging/greybus/loopback.c

   164	
 > 165	#define gb_loopback_stats_attrs(field) do { \
   166		gb_loopback_ro_stats_attr(field, min, u);		\
   167		gb_loopback_ro_stats_attr(field, max, u);		\
   168		gb_loopback_ro_avg_attr(field);				\
 > 169		} while (0)
   170	
   171	#define gb_loopback_attr(field, type)					\
   172	static ssize_t field##_show(struct device *dev,				\
   173				    struct device_attribute *attr,		\
   174				    char *buf)					\
   175	{									\
   176		struct gb_loopback *gb = dev_get_drvdata(dev);			\
   177		return sprintf(buf, "%" #type "\n", gb->field);			\
   178	}									\
   179	static ssize_t field##_store(struct device *dev,			\
   180				    struct device_attribute *attr,		\
   181				    const char *buf,				\
   182				    size_t len)					\
   183	{									\
   184		int ret;							\
   185		struct gb_loopback *gb = dev_get_drvdata(dev);			\
   186		mutex_lock(&gb->mutex);						\
   187		ret = sscanf(buf, "%"#type, &gb->field);			\
   188		if (ret != 1)							\
   189			len = -EINVAL;						\
   190		else								\
   191			gb_loopback_check_attr(gb, bundle);			\
   192		mutex_unlock(&gb->mutex);					\
   193		return len;							\
   194	}									\
   195	static DEVICE_ATTR_RW(field)
   196	
   197	#define gb_dev_loopback_ro_attr(field, conn)				\
   198	static ssize_t field##_show(struct device *dev,		\
   199				    struct device_attribute *attr,		\
   200				    char *buf)					\
   201	{									\
   202		struct gb_loopback *gb = dev_get_drvdata(dev);			\
   203		return sprintf(buf, "%u\n", gb->field);				\
   204	}									\
   205	static DEVICE_ATTR_RO(field)
   206	
   207	#define gb_dev_loopback_rw_attr(field, type)				\
   208	static ssize_t field##_show(struct device *dev,				\
   209				    struct device_attribute *attr,		\
   210				    char *buf)					\
   211	{									\
   212		struct gb_loopback *gb = dev_get_drvdata(dev);			\
   213		return sprintf(buf, "%" #type "\n", gb->field);			\
   214	}									\
   215	static ssize_t field##_store(struct device *dev,			\
   216				    struct device_attribute *attr,		\
   217				    const char *buf,				\
   218				    size_t len)					\
   219	{									\
   220		int ret;							\
   221		struct gb_loopback *gb = dev_get_drvdata(dev);			\
   222		mutex_lock(&gb->mutex);						\
   223		ret = sscanf(buf, "%"#type, &gb->field);			\
   224		if (ret != 1)							\
   225			len = -EINVAL;						\
   226		else								\
   227			gb_loopback_check_attr(gb);		\
   228		mutex_unlock(&gb->mutex);					\
   229		return len;							\
   230	}									\
   231	static DEVICE_ATTR_RW(field)
   232	
   233	static void gb_loopback_reset_stats(struct gb_loopback *gb);
   234	static void gb_loopback_check_attr(struct gb_loopback *gb)
   235	{
   236		if (gb->us_wait > GB_LOOPBACK_US_WAIT_MAX)
   237			gb->us_wait = GB_LOOPBACK_US_WAIT_MAX;
   238		if (gb->size > gb_dev.size_max)
   239			gb->size = gb_dev.size_max;
   240		gb->requests_timedout = 0;
   241		gb->requests_completed = 0;
   242		gb->iteration_count = 0;
   243		gb->send_count = 0;
   244		gb->error = 0;
   245	
   246		if (kfifo_depth < gb->iteration_max) {
   247			dev_warn(gb->dev,
   248				 "cannot log bytes %u kfifo_depth %u\n",
   249				 gb->iteration_max, kfifo_depth);
   250		}
   251		kfifo_reset_out(&gb->kfifo_lat);
   252	
   253		switch (gb->type) {
   254		case GB_LOOPBACK_TYPE_PING:
   255		case GB_LOOPBACK_TYPE_TRANSFER:
   256		case GB_LOOPBACK_TYPE_SINK:
   257			gb->jiffy_timeout = usecs_to_jiffies(gb->timeout);
   258			if (!gb->jiffy_timeout)
   259				gb->jiffy_timeout = GB_LOOPBACK_TIMEOUT_MIN;
   260			else if (gb->jiffy_timeout > GB_LOOPBACK_TIMEOUT_MAX)
   261				gb->jiffy_timeout = GB_LOOPBACK_TIMEOUT_MAX;
   262			gb_loopback_reset_stats(gb);
   263			wake_up(&gb->wq);
   264			break;
   265		default:
   266			gb->type = 0;
   267			break;
   268		}
   269	}
   270	
   271	/* Time to send and receive one message */
   272	gb_loopback_stats_attrs(latency);
   273	/* Number of requests sent per second on this cport */
   274	gb_loopback_stats_attrs(requests_per_second);
   275	/* Quantity of data sent and received on this cport */
   276	gb_loopback_stats_attrs(throughput);
   277	/* Latency across the UniPro link from APBridge's perspective */
   278	gb_loopback_stats_attrs(apbridge_unipro_latency);
   279	/* Firmware induced overhead in the GPBridge */
   280	gb_loopback_stats_attrs(gbphy_firmware_latency);
   281	
   282	/* Number of errors encountered during loop */
   283	gb_loopback_ro_attr(error);
   284	/* Number of requests successfully completed async */
   285	gb_loopback_ro_attr(requests_completed);
   286	/* Number of requests timed out async */
   287	gb_loopback_ro_attr(requests_timedout);
   288	/* Timeout minimum in useconds */
   289	gb_loopback_ro_attr(timeout_min);
   290	/* Timeout minimum in useconds */
   291	gb_loopback_ro_attr(timeout_max);
   292	
   293	/*
   294	 * Type of loopback message to send based on protocol type definitions
   295	 * 0 => Don't send message
   296	 * 2 => Send ping message continuously (message without payload)
   297	 * 3 => Send transfer message continuously (message with payload,
   298	 *					   payload returned in response)
   299	 * 4 => Send a sink message (message with payload, no payload in response)
   300	 */
   301	gb_dev_loopback_rw_attr(type, d);
   302	/* Size of transfer message payload: 0-4096 bytes */
   303	gb_dev_loopback_rw_attr(size, u);
   304	/* Time to wait between two messages: 0-1000 ms */
   305	gb_dev_loopback_rw_attr(us_wait, d);
   306	/* Maximum iterations for a given operation: 1-(2^32-1), 0 implies infinite */
   307	gb_dev_loopback_rw_attr(iteration_max, u);
   308	/* The current index of the for (i = 0; i < iteration_max; i++) loop */
   309	gb_dev_loopback_ro_attr(iteration_count, false);
   310	/* A flag to indicate synchronous or asynchronous operations */
   311	gb_dev_loopback_rw_attr(async, u);
   312	/* Timeout of an individual asynchronous request */
   313	gb_dev_loopback_rw_attr(timeout, u);
   314	/* Maximum number of in-flight operations before back-off */
   315	gb_dev_loopback_rw_attr(outstanding_operations_max, u);
   316	
   317	static struct attribute *loopback_attrs[] = {
 > 318		&dev_attr_latency_min.attr,
 > 319		&dev_attr_latency_max.attr,
 > 320		&dev_attr_latency_avg.attr,
 > 321		&dev_attr_requests_per_second_min.attr,
 > 322		&dev_attr_requests_per_second_max.attr,
 > 323		&dev_attr_requests_per_second_avg.attr,
 > 324		&dev_attr_throughput_min.attr,
 > 325		&dev_attr_throughput_max.attr,
 > 326		&dev_attr_throughput_avg.attr,
 > 327		&dev_attr_apbridge_unipro_latency_min.attr,
 > 328		&dev_attr_apbridge_unipro_latency_max.attr,
 > 329		&dev_attr_apbridge_unipro_latency_avg.attr,
 > 330		&dev_attr_gbphy_firmware_latency_min.attr,
 > 331		&dev_attr_gbphy_firmware_latency_max.attr,
 > 332		&dev_attr_gbphy_firmware_latency_avg.attr,
   333		&dev_attr_type.attr,
   334		&dev_attr_size.attr,
   335		&dev_attr_us_wait.attr,
   336		&dev_attr_iteration_count.attr,
   337		&dev_attr_iteration_max.attr,
   338		&dev_attr_async.attr,
   339		&dev_attr_error.attr,
   340		&dev_attr_requests_completed.attr,
   341		&dev_attr_requests_timedout.attr,
   342		&dev_attr_timeout.attr,
   343		&dev_attr_outstanding_operations_max.attr,
   344		&dev_attr_timeout_min.attr,
   345		&dev_attr_timeout_max.attr,
   346		NULL,
   347	};
   348	ATTRIBUTE_GROUPS(loopback);
   349	

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

Attachment: .config.gz
Description: application/gzip

_______________________________________________
greybus-dev mailing list
greybus-dev@xxxxxxxxxxxxxxxx
https://lists.linaro.org/mailman/listinfo/greybus-dev

[Index of Archives]     [Asterisk App Development]     [PJ SIP]     [Gnu Gatekeeper]     [IETF Sipping]     [Info Cyrus]     [ALSA User]     [Fedora Linux Users]     [Linux SCTP]     [DCCP]     [Gimp]     [Yosemite News]     [Deep Creek Hot Springs]     [Yosemite Campsites]     [ISDN Cause Codes]     [Asterisk Books]

  Powered by Linux