diff mbox

[1/3] xhci: Allow more than 32 quirks

Message ID 20180517125836.32601-2-marc.zyngier@arm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Marc Zyngier May 17, 2018, 12:58 p.m. UTC
We now have 32 different quirks, and the field that holds them
is full. Let's bump it up to the next stage so that we can handle
some more... The type is now an unsigned long long, which is 64bit
on most architectures.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 drivers/usb/host/xhci.c | 6 +++---
 drivers/usb/host/xhci.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Greg KH May 17, 2018, 1:28 p.m. UTC | #1
On Thu, May 17, 2018 at 01:58:34PM +0100, Marc Zyngier wrote:
> We now have 32 different quirks, and the field that holds them
> is full. Let's bump it up to the next stage so that we can handle
> some more... The type is now an unsigned long long, which is 64bit
> on most architectures.
> 
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> ---
>  drivers/usb/host/xhci.c | 6 +++---
>  drivers/usb/host/xhci.h | 2 +-
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> index 711da3306b14..8dba26d3de07 100644
> --- a/drivers/usb/host/xhci.c
> +++ b/drivers/usb/host/xhci.c
> @@ -33,8 +33,8 @@ static int link_quirk;
>  module_param(link_quirk, int, S_IRUGO | S_IWUSR);
>  MODULE_PARM_DESC(link_quirk, "Don't clear the chain bit on a link TRB");
>  
> -static unsigned int quirks;
> -module_param(quirks, uint, S_IRUGO);
> +static unsigned long long quirks;
> +module_param(quirks, ullong, S_IRUGO);
>  MODULE_PARM_DESC(quirks, "Bit flags for quirks to be enabled as default");
>  
>  /* TODO: copied from ehci-hcd.c - can this be refactored? */
> @@ -4963,7 +4963,7 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks)
>  		return retval;
>  	xhci_dbg(xhci, "Called HCD init\n");
>  
> -	xhci_info(xhci, "hcc params 0x%08x hci version 0x%x quirks 0x%08x\n",
> +	xhci_info(xhci, "hcc params 0x%08x hci version 0x%x quirks 0x%016llx\n",
>  		  xhci->hcc_params, xhci->hci_version, xhci->quirks);
>  
>  	return 0;
> diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
> index 6dfc4867dbcf..42848dfc3445 100644
> --- a/drivers/usb/host/xhci.h
> +++ b/drivers/usb/host/xhci.h
> @@ -1787,7 +1787,7 @@ struct xhci_hcd {
>  #define XHCI_STATE_DYING	(1 << 0)
>  #define XHCI_STATE_HALTED	(1 << 1)
>  #define XHCI_STATE_REMOVING	(1 << 2)
> -	unsigned int		quirks;
> +	unsigned long long	quirks;

u64?

>  #define	XHCI_LINK_TRB_QUIRK	(1 << 0)
>  #define XHCI_RESET_EP_QUIRK	(1 << 1)
>  #define XHCI_NEC_HOST		(1 << 2)

And these all can use BIT(), right?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Marc Zyngier May 18, 2018, 4:02 p.m. UTC | #2
On 17/05/18 14:28, Greg KH wrote:
> On Thu, May 17, 2018 at 01:58:34PM +0100, Marc Zyngier wrote:
>> We now have 32 different quirks, and the field that holds them
>> is full. Let's bump it up to the next stage so that we can handle
>> some more... The type is now an unsigned long long, which is 64bit
>> on most architectures.
>>
>> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
>> ---
>>  drivers/usb/host/xhci.c | 6 +++---
>>  drivers/usb/host/xhci.h | 2 +-
>>  2 files changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
>> index 711da3306b14..8dba26d3de07 100644
>> --- a/drivers/usb/host/xhci.c
>> +++ b/drivers/usb/host/xhci.c
>> @@ -33,8 +33,8 @@ static int link_quirk;
>>  module_param(link_quirk, int, S_IRUGO | S_IWUSR);
>>  MODULE_PARM_DESC(link_quirk, "Don't clear the chain bit on a link TRB");
>>  
>> -static unsigned int quirks;
>> -module_param(quirks, uint, S_IRUGO);
>> +static unsigned long long quirks;
>> +module_param(quirks, ullong, S_IRUGO);
>>  MODULE_PARM_DESC(quirks, "Bit flags for quirks to be enabled as default");
>>  
>>  /* TODO: copied from ehci-hcd.c - can this be refactored? */
>> @@ -4963,7 +4963,7 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks)
>>  		return retval;
>>  	xhci_dbg(xhci, "Called HCD init\n");
>>  
>> -	xhci_info(xhci, "hcc params 0x%08x hci version 0x%x quirks 0x%08x\n",
>> +	xhci_info(xhci, "hcc params 0x%08x hci version 0x%x quirks 0x%016llx\n",
>>  		  xhci->hcc_params, xhci->hci_version, xhci->quirks);
>>  
>>  	return 0;
>> diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
>> index 6dfc4867dbcf..42848dfc3445 100644
>> --- a/drivers/usb/host/xhci.h
>> +++ b/drivers/usb/host/xhci.h
>> @@ -1787,7 +1787,7 @@ struct xhci_hcd {
>>  #define XHCI_STATE_DYING	(1 << 0)
>>  #define XHCI_STATE_HALTED	(1 << 1)
>>  #define XHCI_STATE_REMOVING	(1 << 2)
>> -	unsigned int		quirks;
>> +	unsigned long long	quirks;
> 
> u64?

Sure. That's just slightly odd with the "unsigned long long" imposed by
the module_param above.

> 
>>  #define	XHCI_LINK_TRB_QUIRK	(1 << 0)
>>  #define XHCI_RESET_EP_QUIRK	(1 << 1)
>>  #define XHCI_NEC_HOST		(1 << 2)
> 
> And these all can use BIT(), right?
If you're happy with the churn, I'll repaint them.

Thanks,

	M.
diff mbox

Patch

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 711da3306b14..8dba26d3de07 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -33,8 +33,8 @@  static int link_quirk;
 module_param(link_quirk, int, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(link_quirk, "Don't clear the chain bit on a link TRB");
 
-static unsigned int quirks;
-module_param(quirks, uint, S_IRUGO);
+static unsigned long long quirks;
+module_param(quirks, ullong, S_IRUGO);
 MODULE_PARM_DESC(quirks, "Bit flags for quirks to be enabled as default");
 
 /* TODO: copied from ehci-hcd.c - can this be refactored? */
@@ -4963,7 +4963,7 @@  int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks)
 		return retval;
 	xhci_dbg(xhci, "Called HCD init\n");
 
-	xhci_info(xhci, "hcc params 0x%08x hci version 0x%x quirks 0x%08x\n",
+	xhci_info(xhci, "hcc params 0x%08x hci version 0x%x quirks 0x%016llx\n",
 		  xhci->hcc_params, xhci->hci_version, xhci->quirks);
 
 	return 0;
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 6dfc4867dbcf..42848dfc3445 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1787,7 +1787,7 @@  struct xhci_hcd {
 #define XHCI_STATE_DYING	(1 << 0)
 #define XHCI_STATE_HALTED	(1 << 1)
 #define XHCI_STATE_REMOVING	(1 << 2)
-	unsigned int		quirks;
+	unsigned long long	quirks;
 #define	XHCI_LINK_TRB_QUIRK	(1 << 0)
 #define XHCI_RESET_EP_QUIRK	(1 << 1)
 #define XHCI_NEC_HOST		(1 << 2)