Hi, I have a question in PCF50633 driver code that in the path
/kernel/driver/mfd/pcf50633-core.c

 

There has a function named show_dump_regs() at 156 lines,

 

--**************************************************************************
********---

static ssize_t show_dump_regs(struct device *dev, struct device_attribute
*attr, char *buf)

{

        struct pcf50633 *pcf = dev_get_drvdata(dev);

        u8 dump[16];

        int n, n1, idx = 0;

        char *buf1 = buf;

        static u8 address_no_read[] = { /* must be ascending */

                PCF50633_REG_INT1,    //02h

                PCF50633_REG_INT2,    //03h

                PCF50633_REG_INT3,    //04h

                PCF50633_REG_INT4,    //05h

                PCF50633_REG_INT5,    //06h

                0 /* terminator */

        };

 

        for (n = 0; n < 256; n += sizeof(dump)) {

                for (n1 = 0; n1 < sizeof(dump); n1++)

                        if (n == address_no_read[idx]) {

                                idx++;

                                dump[n1] = 0x00;

                        } else

                                dump[n1] = pcf50633_reg_read(pcf, n + n1);

 

                hex_dump_to_buffer(dump, sizeof(dump), 16, 1, buf1, 128, 0);

                buf1 += strlen(buf1);

                *buf1++ = '\n';

                *buf1 = '\0';

        }

 

        return buf1 - buf;

}

--**************************************************************************
********---

 

 

My question is already marked by red color.

 

The “if condition”  è if (n == address_no_read[idx])  

 

I think that n should be changed from n to n1!!

 

Because you don’t want the PCF50633_REG_INTx to be read, so when the index
is increased to the address of PCF50633_REG_INTx , it should not be read and
gave 0 to the dump array. Right?

 

If you used “n” to the “if condition”, n += sizeof(dump), it is increased by
16. The condition will never be true If we use “n” !!!!

 

Sorry, my English is so pool. Hope you understand what I say!!

 

 

 

Best Regards

Andy

_______________________________________________
android-freerunner mailing list
android-freerunner@android.koolu.org
http://android.koolu.org/listinfo.cgi/android-freerunner-koolu.org

Reply via email to