Re: [PATCH] iio:proximity:hx9031as: Add TYHX HX9031AS/HX9023S sensor driver

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

 



On Sat, May 25, 2024 at 05:00:59PM +0300, Andy Shevchenko wrote:
> On Thu, May 23, 2024 at 3:42 PM Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:
> 
> 
> > 5e5a419c9407f6 Yasin Lee 2024-05-10  1110  static ssize_t hx9031as_raw_data_show(struct file *file, char __user *user_buf, size_t count, loff_t *ppos)
> > 5e5a419c9407f6 Yasin Lee 2024-05-10  1111  {
> > 5e5a419c9407f6 Yasin Lee 2024-05-10  1112       char buf[BUF_SIZE] = {0};
> > 5e5a419c9407f6 Yasin Lee 2024-05-10  1113       char *p = buf;
> > 5e5a419c9407f6 Yasin Lee 2024-05-10  1114       int ii = 0;
> > 5e5a419c9407f6 Yasin Lee 2024-05-10  1115
> > 5e5a419c9407f6 Yasin Lee 2024-05-10  1116       hx9031as_sample();
> > 5e5a419c9407f6 Yasin Lee 2024-05-10  1117       for (ii = 0; ii < HX9031AS_CH_NUM; ii++) {
> > 5e5a419c9407f6 Yasin Lee 2024-05-10 @1118               p += snprintf(p, PAGE_SIZE, "ch[%d]: DIFF=%-8d, RAW=%-8d, OFFSET=%-8d, BL=%-8d, LP=%-8d\n",
> >                                                                          ^^^^^^^^^
> 
> 
> > Also use scnprintf() instead of snprintf() unless you need to check the
> > results.
> 
> This is incorrect advice. You should recommend sysfs_emit() /
> sysfs_emit_at() in this kind of case.

No, this is not sysfs code.  It's debugfs.  The API is completely
different.

regards,
dan carpenter




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux