Re: [PATCH 2/2 v4] input: add SparkFun Qwiic Joystick driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



15.06.21 07:57, Dmitry Torokhov пише:

>> +struct qwiic_ver {
>> +	u8 major;
>> +	u8 minor;
>> +};
>> +
>> +struct qwiic_data {
>> +	__be16 x;
>> +	__be16 y;
>> +	u8 thumb;
>> +} __packed;
> 
> The members of this structure are naturally aligned, so there is no need
> to declare it as __packed.


But struct qwiic_data require packed attribute, because without that it will be 6 bytes not 5.

>> +
>> +static void qwiic_poll(struct input_dev *input)
>> +{
>> +	struct qwiic_jsk *priv;
>> +	struct qwiic_data data;
>> +	int err;
>> +
>> +	priv = input_get_drvdata(input);
>> +
>> +	err = i2c_smbus_read_i2c_block_data(priv->client, QWIIC_JSK_REG_DATA,
>> +					    sizeof(data), (u8 *)&data);
>> +	if (err != sizeof(data))
>> +		return;
>> +
>> +	input_report_abs(input, ABS_X, be16_to_cpu(data.x) >> 6);
>> +	input_report_abs(input, ABS_Y, be16_to_cpu(data.y) >> 6);
>> +	input_report_key(input, BTN_THUMBL, !data.thumb);
>> +	input_sync(input);
>> +}
>> +
>> +static int qwiic_probe(struct i2c_client *client,
>> +		       const struct i2c_device_id *id)
> 
> The probe() does not use the i2c_device_id parameter, so I will switch
> it to probe_new() to avoid the temptation of using it in the future.
> 
> Please let me know if you disagree, otherwise I will go and apply (no
> need to resubmit).
> 
> Thanks.
> 

-- 
Best regards,
Oleh Kravchenko




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux