Re: [PATCH 09/10] mceusb: int to bool conversion

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

 



Em 19-11-2010 21:43, David HÃrdeman escreveu:
> Convert boolean variables to use the corresponding data type.
> 
> Signed-off-by: David HÃrdeman <david@xxxxxxxxxxx>

Waiting for Jarod's comments, but the same comment I made on the previous
patch applies to this one.
> ---
>  drivers/media/rc/mceusb.c |   62 +++++++++++++++++++--------------------------
>  1 files changed, 26 insertions(+), 36 deletions(-)
> 
> diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
> index ef9bddc..bb6e2dc 100644
> --- a/drivers/media/rc/mceusb.c
> +++ b/drivers/media/rc/mceusb.c
> @@ -103,9 +103,9 @@
>  
>  /* module parameters */
>  #ifdef CONFIG_USB_DEBUG
> -static int debug = 1;
> +static bool debug = true;
>  #else
> -static int debug;
> +static bool debug;
>  #endif

Not sure if we should convert debug parameter to bool: we may need to have
extra debug levels, or maybe just convert to use dev_dbg(), allowing enabling
them via dynamic_printk.

>  
>  /* general constants */
> @@ -151,12 +151,12 @@ enum mceusb_model_type {
>  };
>  
>  struct mceusb_model {
> -	u32 mce_gen1:1;
> -	u32 mce_gen2:1;
> -	u32 mce_gen3:1;
> -	u32 tx_mask_inverted:1;
> -	u32 is_polaris:1;
> -	u32 no_tx:1;
> +	bool mce_gen1:1;
> +	bool mce_gen2:1;
> +	bool mce_gen3:1;
> +	bool tx_mask_inverted:1;
> +	bool is_polaris:1;
> +	bool no_tx:1;
>  
>  	const char *rc_map;	/* Allow specify a per-board map */
>  	const char *name;	/* per-board name */
> @@ -164,22 +164,22 @@ struct mceusb_model {
>  
>  static const struct mceusb_model mceusb_model[] = {
>  	[MCE_GEN1] = {
> -		.mce_gen1 = 1,
> -		.tx_mask_inverted = 1,
> +		.mce_gen1 = true,
> +		.tx_mask_inverted = true,
>  	},
>  	[MCE_GEN2] = {
> -		.mce_gen2 = 1,
> +		.mce_gen2 = true,
>  	},
>  	[MCE_GEN2_TX_INV] = {
> -		.mce_gen2 = 1,
> -		.tx_mask_inverted = 1,
> +		.mce_gen2 = true,
> +		.tx_mask_inverted = true,
>  	},
>  	[MCE_GEN3] = {
> -		.mce_gen3 = 1,
> -		.tx_mask_inverted = 1,
> +		.mce_gen3 = true,
> +		.tx_mask_inverted = true,
>  	},
>  	[POLARIS_EVK] = {
> -		.is_polaris = 1,
> +		.is_polaris = true,
>  		/*
>  		 * In fact, the EVK is shipped without
>  		 * remotes, but we should have something handy,
> @@ -189,8 +189,8 @@ static const struct mceusb_model mceusb_model[] = {
>  		.name = "Conexant Hybrid TV (cx231xx) MCE IR",
>  	},
>  	[CX_HYBRID_TV] = {
> -		.is_polaris = 1,
> -		.no_tx = 1, /* tx isn't wired up at all */
> +		.is_polaris = true,
> +		.no_tx = true, /* tx isn't wired up at all */
>  		.name = "Conexant Hybrid TV (cx231xx) MCE IR",
>  	},
>  };
> @@ -344,10 +344,10 @@ struct mceusb_dev {
>  	u8 cmd, rem;		/* Remaining IR data bytes in packet */
>  
>  	struct {
> -		u32 connected:1;
> -		u32 tx_mask_inverted:1;
> -		u32 microsoft_gen1:1;
> -		u32 no_tx:1;
> +		bool connected:1;
> +		bool tx_mask_inverted:1;
> +		bool microsoft_gen1:1;
> +		bool no_tx:1;
>  	} flags;
>  
>  	/* transmit support */
> @@ -1090,21 +1090,11 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf,
>  	int pipe, maxp, i;
>  	char buf[63], name[128] = "";
>  	enum mceusb_model_type model = id->driver_info;
> -	bool is_gen3;
> -	bool is_microsoft_gen1;
> -	bool tx_mask_inverted;
> -	bool is_polaris;
>  
>  	dev_dbg(&intf->dev, "%s called\n", __func__);
> -
>  	idesc  = intf->cur_altsetting;
>  
> -	is_gen3 = mceusb_model[model].mce_gen3;
> -	is_microsoft_gen1 = mceusb_model[model].mce_gen1;
> -	tx_mask_inverted = mceusb_model[model].tx_mask_inverted;
> -	is_polaris = mceusb_model[model].is_polaris;
> -
> -	if (is_polaris) {
> +	if (mceusb_model[model].is_polaris) {
>  		/* Interface 0 is IR */
>  		if (idesc->desc.bInterfaceNumber)
>  			return -ENODEV;
> @@ -1167,8 +1157,8 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf,
>  	ir->usbdev = dev;
>  	ir->dev = &intf->dev;
>  	ir->len_in = maxp;
> -	ir->flags.microsoft_gen1 = is_microsoft_gen1;
> -	ir->flags.tx_mask_inverted = tx_mask_inverted;
> +	ir->flags.microsoft_gen1 = mceusb_model[model].mce_gen1;
> +	ir->flags.tx_mask_inverted = mceusb_model[model].tx_mask_inverted;
>  	ir->flags.no_tx = mceusb_model[model].no_tx;
>  	ir->model = model;
>  
> @@ -1203,7 +1193,7 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf,
>  	/* initialize device */
>  	if (ir->flags.microsoft_gen1)
>  		mceusb_gen1_init(ir);
> -	else if (!is_gen3)
> +	else if (!mceusb_model[model].mce_gen3)
>  		mceusb_gen2_init(ir);
>  
>  	mceusb_get_parameters(ir);
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux