On Mon, Aug 13, 2012 at 10:06:26AM +0800, wei_wang@xxxxxxxxxxxxxx wrote: > +int rtsx_pci_read_phy_register(struct rtsx_pcr *pcr, u8 addr, u16 *val) > +{ > + int err, i, finished = 0; > + u16 data = 0; > + u8 *ptr, tmp; > + > + rtsx_pci_init_cmd(pcr); > + > + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PHYADDR, 0xFF, addr); > + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PHYRWCTL, 0xFF, 0x80); > + > + err = rtsx_pci_send_cmd(pcr, 100); > + if (err < 0) > + return err; > + > + for (i = 0; i < 100000; i++) { > + err = rtsx_pci_read_register(pcr, PHYRWCTL, &tmp); > + if (err < 0) > + return err; > + > + if (!(tmp & 0x80)) { > + finished = 1; > + break; > + } > + } > + > + if (!finished) > + return -ETIMEDOUT; > + > + rtsx_pci_init_cmd(pcr); > + > + rtsx_pci_add_cmd(pcr, READ_REG_CMD, PHYDATA0, 0, 0); > + rtsx_pci_add_cmd(pcr, READ_REG_CMD, PHYDATA1, 0, 0); > + > + err = rtsx_pci_send_cmd(pcr, 100); > + if (err < 0) > + return err; > + > + ptr = rtsx_pci_get_cmd_data(pcr); > + data = ((u16)ptr[1] << 8) || ptr[0]; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Looks like bitwise OR was intended here. > + > + if (val) > + *val = data; > + > + return 0; > +} regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html