On Mon, Sep 05, 2011 at 05:33:15PM +0100, Jonathan Cameron wrote: > +static bool lis3l02dq_reg_writeable(struct device *dev, unsigned int reg) > +{ > + return (reg == LIS3L02DQ_REG_OFFSET_X_ADDR || > + reg == LIS3L02DQ_REG_OFFSET_Y_ADDR || > + reg == LIS3L02DQ_REG_OFFSET_Z_ADDR || These would all look nicer as switch statements I think - this doesn't look terribly idiomatic. > +static bool lis3l02dq_reg_volatile(struct device *dev, unsigned int reg) > +{ > + return (reg == LIS3L02DQ_REG_WAKE_UP_ACK_ADDR || > + reg == LIS3L02DQ_REG_OUT_X_L_ADDR || > + reg == LIS3L02DQ_REG_OUT_X_H_ADDR || > + reg == LIS3L02DQ_REG_OUT_Y_L_ADDR || > + reg == LIS3L02DQ_REG_OUT_Y_H_ADDR || > + reg == LIS3L02DQ_REG_OUT_Z_L_ADDR || > + reg == LIS3L02DQ_REG_OUT_Z_H_ADDR); > +} > +/* Read the data registers might result in unexpected datardy signal > + * so they have to be marked precious */ > +static bool lis3l02dq_reg_precious(struct device *dev, unsigned int reg) > +{ > + return (reg == LIS3L02DQ_REG_WAKE_UP_ACK_ADDR || > + reg == LIS3L02DQ_REG_OUT_X_L_ADDR || > + reg == LIS3L02DQ_REG_OUT_X_H_ADDR || > + reg == LIS3L02DQ_REG_OUT_Y_L_ADDR || > + reg == LIS3L02DQ_REG_OUT_Y_H_ADDR || > + reg == LIS3L02DQ_REG_OUT_Z_L_ADDR || > + reg == LIS3L02DQ_REG_OUT_Z_H_ADDR); These could perhaps be the same function? -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html