lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 17 Dec 2021 08:10:45 +0000
From:   Tony Huang 黃懷厚 <tony.huang@...plus.com>
To:     gregkh <gregkh@...uxfoundation.org>
CC:     Wells Lu 呂芳騰 <wells.lu@...plus.com>,
        Rob Herring <robh+dt@...nel.org>,
        DTML <devicetree@...r.kernel.org>,
        "Linux Kernel Mailing List" <linux-kernel@...r.kernel.org>,
        Derek Kiernan <derek.kiernan@...inx.com>,
        Dragan Cvetic <dragan.cvetic@...inx.com>,
        "Arnd Bergmann" <arnd@...db.de>,
        黃懷厚 <tonyhuang.sunplus@...il.com>
Subject: RE: [PATCH v4 2/2] misc: Add iop driver for Sunplus SP7021

Dear Gregkh:

> > +
> > +static ssize_t sp_iop_state1_show(struct device *dev, struct
> > +device_attribute *attr, char *buf) {
> > +     struct sp_iop *iop = dev_get_drvdata(dev);
> > +     ssize_t len = 0;
> > +
> > +     sp_iop_standby_mode(iop);
> > +     mdelay(10);
> > +     sp_iop_s1mode(dev, iop);
> > +     return len;
> > +}
> 
> This function is not showing anything.
> 
							
The purpose of this function:							
SP7021 has three power states:S0, S1 and S3.							
S0:Default domain is on. IOP domain is on. AO domain is on.							
S1:Default domain is off. IOP domain is on. AO domain is on.							
S3:Default domain is off. IOP domain is off. AO domain is on.							
System enter S1 mode when read sysfs sp_iop_state1,							
							
I hope to provide users with the ability to enter S1 mode by themselves.							
So I cannot use DEVICE_ATTR. I should use file_operations method.							

> > +
> > +static ssize_t sp_iop_state1_store(struct device *dev, struct
> device_attribute *attr,
> > +                                const char *buf, size_t count) {
> > +     ssize_t len = 0;
> > +
> > +     return len;
> > +}
> 
> Why do you have an empty store function?
> 
> > +
> > +static ssize_t sp_iop_mode_show(struct device *dev, struct
> > +device_attribute *attr, char *buf) {
> > +     struct sp_iop *iop = dev_get_drvdata(dev);
> > +     ssize_t len = 0;
> > +
> > +     if (iop->mode == 0)
> > +             dev_info(dev, "iop_normal_mode\n");
> > +     else if (iop->mode == 1)
> > +             dev_info(dev, "iop_standby_mode\n");
> > +     return len;
> > +}
> 
> Again, this is not returning anything in sysfs.
> 
> How was this tested???
> 

I type "echo 0 > mode". Device driver will load normal .bin for 8051 in sp_iop_mode_store().								
I type "echo 1 > mode". Device driver will load standby.bin for 8051 in sp_iop_mode_store().								
I type "cat mode". I can know whether the current bin code is normal or standby in 8051.								
								
I hope to provide users with the ability to switch bin files by themselves.								
So I need to use file_operations to achieve my goal.								
Not using DEVICE_ATTR.	Right?								


> > +static ssize_t sp_iop_mode_store(struct device *dev, struct device_attribute
> *attr,
> > +                              const char *buf, size_t count) {
> > +     struct sp_iop *iop = dev_get_drvdata(dev);
> > +     unsigned char ret = count;
> > +
> > +     if (buf[0] == '0') {
> > +             sp_iop_normal_mode(iop);
> > +             dev_info(dev, "Switch to normal mode.\n");
> > +     } else if (buf[0] == '1') {
> > +             sp_iop_standby_mode(iop);
> > +             dev_info(dev, "Switch to standby mode.\n");
> > +     } else {
> > +             dev_info(dev, "echo 0 or 1 mode\n");
> > +             dev_info(dev, "0:normal mode\n");
> > +             dev_info(dev, "1:standby mode\n");
> > +     }
> > +     return ret;
> > +}
> 
> dev_info() is NOT for stuff like this at all.  You do not display a "help" file or
> anything else like that in this way.
> 
> Please use sysfs correctly.
> 
> Also, there is a function to read 1/0 from sysfs, please use that.
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ