On Wed, Jun 25, 2025 at 02:31:02PM +0800, 吳梓豪 wrote: > Krzysztof Kozlowski <krzk@xxxxxxxxxx> 於 2025年6月24日 週二 下午3:48寫道: > > > > On 24/06/2025 09:41, tzuhao.wtmh@xxxxxxxxx wrote: > > > +static int > > > +MP2869A_read_byte_data(struct i2c_client *client, int page, int reg) > > > +{ > > > + switch (reg) { > > > + case PMBUS_VOUT_MODE: > > > + /* Enforce VOUT direct format. */ > > > + return PB_VOUT_MODE_DIRECT; > > > + default: > > > + return -ENODATA; > > > + } > > > +} > > > + > > > +static int > > > +MP2869A_identify_vout_format(struct i2c_client *client, > > > > Use Linux coding style, so lowercase for variables, types and functions. > > Everywhere (except when coding style tells you different, so please read > > it). > > > > > + struct MP2869A_data *data) > > > +{ > > > + int i, ret; > > > + > > > + for (i = 0; i < data->info.pages; i++) { > > > + ret = i2c_smbus_write_byte_data(client, PMBUS_PAGE, i); > > > + if (ret < 0) > > > + return ret; > > > + > > > + ret = i2c_smbus_read_word_data(client, MP2869A_VOUT_MODE); > > > + if (ret < 0) > > > + return ret; > > > + > > > + switch (ret & MP2869A_VOUT_MODE_MASK) { > > > + case MP2869A_VOUT_MODE_VID: > > > + data->vout_format[i] = vid; > > > + break; > > > + default: > > > + return -EINVAL; > > > + } > > > + } > > > > Messed indentation in multiple places. > > > > > + return 0; > > > +} > > > + > > > +static struct pmbus_driver_info MP2869A_info = { > > > > This is const. > Since info will be modified by mp2869a_read_vout at runtime, I chose > not to make it constant That is a no-go. There can be multiple instances of the chip in a system, each requiring its own info data structure. If the structure is modified at runtime it needs to be copied first. Guenter