Hi Charles, On Tue, May 14, 2024 at 07:44:43PM +0800, Charles Wang wrote: > +static ssize_t registers_read(struct file *filp, struct kobject *kobj, > + struct bin_attribute *bin_attr, char *buf, loff_t off, size_t count) > +{ > + struct regmap *regmap; > + int error; > + > + regmap = dev_get_regmap(kobj_to_dev(kobj), NULL); We already have goodix_berlin_core->regmap, going through drvdata should be cheaper than scanning devres resources for the regmap data, so I'll change this. > + error = regmap_raw_read(regmap, (unsigned int)off, > + buf, count); > + > + return error ? error : count; > +} > + > +static ssize_t registers_write(struct file *filp, struct kobject *kobj, > + struct bin_attribute *bin_attr, char *buf, loff_t off, size_t count) > +{ > + struct regmap *regmap; > + int error; > + > + regmap = dev_get_regmap(kobj_to_dev(kobj), NULL); > + error = regmap_raw_write(regmap, (unsigned int)off, > + buf, count); > + > + return error ? error : count; > +} > + > +BIN_ATTR_RW(registers, 0); I do not think it is a good idea to allow the world read all registers. Any objection to make it BIN_ATTR_ADMIN_RW()? Thanks. -- Dmitry