Search Linux Wireless

Re: [RFC] acer-wmi: Add rfkill support for wireless and bluetooth (v4)

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

 



Hi Carlos,

On Fri, Sep 12, 2008 at 08:44:26PM +0100, Carlos Corbacho wrote:
> +
> +static int acer_rfkill_register(struct device *dev, struct rfkill **rfkill_dev,
> +enum rfkill_type type, char *name, u32 cap)
> +{
> +	int err;
> +	u32 state;
> +	u32 *data;
> +
> +	*rfkill_dev = rfkill_allocate(dev, type);
> +	if (!*rfkill_dev)
> +		return -ENOMEM;
> +	(*rfkill_dev)->name = name;
> +	get_u32(&state, cap);
> +	(*rfkill_dev)->state = state ? RFKILL_STATE_UNBLOCKED :
> +		RFKILL_STATE_SOFT_BLOCKED;
> +	data = kzalloc(sizeof(u32), GFP_KERNEL);
> +	if (!data) {
> +		rfkill_free(*rfkill_dev);
> +		return -ENOMEM;
> +	}
> +	*data = cap;
> +	(*rfkill_dev)->data = data;
> +	(*rfkill_dev)->toggle_radio = acer_rfkill_set;
> +	(*rfkill_dev)->user_claim_unsupported = 1;
> +
> +	err = rfkill_register(*rfkill_dev);
> +	if (err) {
> +		kfree((*rfkill_dev)->data);
> +		rfkill_free(*rfkill_dev);
> +		return err;
> +	}
> +	return 0;
> +}
> +

Sorry if I am late to the party but this function is best to have
'struct rfkill *' return value and use ERR_PTR() to signal errors.

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

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux