Re: [PATCH v2 1/9] iio: hid_Sensors: fix crash during trigger unregister

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

 



On 10/23/13 20:11, Srinivas Pandruvada wrote:
> We can't store the trigger instance created by iio_trigger_alloc, in
> trig field of iio_device structure. This needs to be stored in the
> driver private data. Othewise it can result in crash during module
> unload. Hence created a trig_ptr in the common data structure
> for each HID sensor IIO driver and storing here.
>
> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@xxxxxxxxxxxxxxx>
Other than the use of a void * this is fine. Please fix that little issue
up...
> --- a/include/linux/hid-sensor-hub.h
> +++ b/include/linux/hid-sensor-hub.h
> @@ -184,6 +184,7 @@ struct hid_sensor_common {
>  	struct platform_device *pdev;
>  	unsigned usage_id;
>  	bool data_ready;
> +	void *trig_ptr;
Why a void *?  It's struct iio_trigger *
Just put
struct iio_trigger;
above if you want to (reasonably) avoid including the
header.  Don't use a void pointer unless you really have no way
of knowing what the type is.

>  	struct hid_sensor_hub_attribute_info poll;
>  	struct hid_sensor_hub_attribute_info report_state;
>  	struct hid_sensor_hub_attribute_info power_state;
>
--
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




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux