Re: [PATCH 2/2] android: Add set/get for discovery timeout

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

 



Hi Lukasz,

On Wed, Nov 06, 2013, Lukasz Rymanowski wrote:
>  static bool get_discoverable_timeout(void)
>  {
> -	DBG("Not implemented");
> +	struct hal_ev_adapter_props_changed *ev;
> +	int len;
>  
> -	/* TODO: Add implementation */
> +	len = sizeof(*ev) + sizeof(struct hal_property) + sizeof(uint32_t);
>  

The dynamic memory allocation seems a bit overkill here since the size is
not very big and can be determined even at compile time. I'd consider
doing something like:

	uint8_t buf[sizeof(struct hal_ev_adapter_props_changed) +
			sizeof(struct hal_property) + sizeof(uint32_t)];
	struct hal_ev_adapter_props_changed *ev = (void *) buf;

	...

	ipc_send(..., sizeof(buf), buf, ...);

Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux