diff mbox series

[v4,4/5] Bluetooth: btusb: Collect the common Intel assignments together

Message ID 20190118223407.64818-4-rajatja@google.com (mailing list archive)
State New, archived
Headers show
Series [v4,1/5] usb: split code locating ACPI companion into port and device | expand

Commit Message

Rajat Jain Jan. 18, 2019, 10:34 p.m. UTC
The BTUSB_INTEL and BTUSB_INTEL_NEW have common functions & quirks are
assigned to hdev structure. Lets collect them together instead of
repeating them in different code branches.

Signed-off-by: Rajat Jain <rajatja@google.com>
---
v4: same as v1
v3: same as v1
v2: same as v1

 drivers/bluetooth/btusb.c | 27 ++++++++++++---------------
 1 file changed, 12 insertions(+), 15 deletions(-)

Comments

Marcel Holtmann Jan. 19, 2019, 7:51 p.m. UTC | #1
Hi Rajat,

> The BTUSB_INTEL and BTUSB_INTEL_NEW have common functions & quirks are
> assigned to hdev structure. Lets collect them together instead of
> repeating them in different code branches.
> 
> Signed-off-by: Rajat Jain <rajatja@google.com>
> ---
> v4: same as v1
> v3: same as v1
> v2: same as v1
> 
> drivers/bluetooth/btusb.c | 27 ++++++++++++---------------
> 1 file changed, 12 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
> index 4761499db9ee..59869643cc29 100644
> --- a/drivers/bluetooth/btusb.c
> +++ b/drivers/bluetooth/btusb.c
> @@ -3075,28 +3075,25 @@ static int btusb_probe(struct usb_interface *intf,
> 		data->diag = usb_ifnum_to_if(data->udev, ifnum_base + 2);
> 	}
> #endif
> +	if (id->driver_info & BTUSB_INTEL ||
> +	    id->driver_info & BTUSB_INTEL_NEW) {
> 
> -	if (id->driver_info & BTUSB_INTEL) {
> 		hdev->manufacturer = 2;
> -		hdev->setup = btusb_setup_intel;
> -		hdev->shutdown = btusb_shutdown_intel;
> -		hdev->set_diag = btintel_set_diag_mfg;
> 		hdev->set_bdaddr = btintel_set_bdaddr;
> 		set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks);
> 		set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);
> 		set_bit(HCI_QUIRK_NON_PERSISTENT_DIAG, &hdev->quirks);
> -	}
> 
> -	if (id->driver_info & BTUSB_INTEL_NEW) {
> -		hdev->manufacturer = 2;
> -		hdev->send = btusb_send_frame_intel;
> -		hdev->setup = btusb_setup_intel_new;
> -		hdev->hw_error = btintel_hw_error;
> -		hdev->set_diag = btintel_set_diag;
> -		hdev->set_bdaddr = btintel_set_bdaddr;
> -		set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks);
> -		set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);
> -		set_bit(HCI_QUIRK_NON_PERSISTENT_DIAG, &hdev->quirks);
> +		if (id->driver_info & BTUSB_INTEL) {
> +			hdev->setup = btusb_setup_intel;
> +			hdev->shutdown = btusb_shutdown_intel;
> +			hdev->set_diag = btintel_set_diag_mfg;
> +		} else {
> +			hdev->send = btusb_send_frame_intel;
> +			hdev->setup = btusb_setup_intel_new;
> +			hdev->hw_error = btintel_hw_error;
> +			hdev->set_diag = btintel_set_diag;
> +		}
> 	}

please scrap this patch since it is not making anything easier or simpler. You think it does, but it really doesn’t.

Regards

Marcel
Rajat Jain Jan. 22, 2019, 10:35 p.m. UTC | #2
On Sat, Jan 19, 2019 at 11:51 AM Marcel Holtmann <marcel@holtmann.org> wrote:
>
> Hi Rajat,
>
> > The BTUSB_INTEL and BTUSB_INTEL_NEW have common functions & quirks are
> > assigned to hdev structure. Lets collect them together instead of
> > repeating them in different code branches.
> >
> > Signed-off-by: Rajat Jain <rajatja@google.com>
> > ---
> > v4: same as v1
> > v3: same as v1
> > v2: same as v1
> >
> > drivers/bluetooth/btusb.c | 27 ++++++++++++---------------
> > 1 file changed, 12 insertions(+), 15 deletions(-)
> >
> > diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
> > index 4761499db9ee..59869643cc29 100644
> > --- a/drivers/bluetooth/btusb.c
> > +++ b/drivers/bluetooth/btusb.c
> > @@ -3075,28 +3075,25 @@ static int btusb_probe(struct usb_interface *intf,
> >               data->diag = usb_ifnum_to_if(data->udev, ifnum_base + 2);
> >       }
> > #endif
> > +     if (id->driver_info & BTUSB_INTEL ||
> > +         id->driver_info & BTUSB_INTEL_NEW) {
> >
> > -     if (id->driver_info & BTUSB_INTEL) {
> >               hdev->manufacturer = 2;
> > -             hdev->setup = btusb_setup_intel;
> > -             hdev->shutdown = btusb_shutdown_intel;
> > -             hdev->set_diag = btintel_set_diag_mfg;
> >               hdev->set_bdaddr = btintel_set_bdaddr;
> >               set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks);
> >               set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);
> >               set_bit(HCI_QUIRK_NON_PERSISTENT_DIAG, &hdev->quirks);
> > -     }
> >
> > -     if (id->driver_info & BTUSB_INTEL_NEW) {
> > -             hdev->manufacturer = 2;
> > -             hdev->send = btusb_send_frame_intel;
> > -             hdev->setup = btusb_setup_intel_new;
> > -             hdev->hw_error = btintel_hw_error;
> > -             hdev->set_diag = btintel_set_diag;
> > -             hdev->set_bdaddr = btintel_set_bdaddr;
> > -             set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks);
> > -             set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);
> > -             set_bit(HCI_QUIRK_NON_PERSISTENT_DIAG, &hdev->quirks);
> > +             if (id->driver_info & BTUSB_INTEL) {
> > +                     hdev->setup = btusb_setup_intel;
> > +                     hdev->shutdown = btusb_shutdown_intel;
> > +                     hdev->set_diag = btintel_set_diag_mfg;
> > +             } else {
> > +                     hdev->send = btusb_send_frame_intel;
> > +                     hdev->setup = btusb_setup_intel_new;
> > +                     hdev->hw_error = btintel_hw_error;
> > +                     hdev->set_diag = btintel_set_diag;
> > +             }
> >       }
>
> please scrap this patch since it is not making anything easier or simpler. You think it does, but it really doesn’t.

OK, will do.

Thanks,

Rajat

>
> Regards
>
> Marcel
>
diff mbox series

Patch

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 4761499db9ee..59869643cc29 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -3075,28 +3075,25 @@  static int btusb_probe(struct usb_interface *intf,
 		data->diag = usb_ifnum_to_if(data->udev, ifnum_base + 2);
 	}
 #endif
+	if (id->driver_info & BTUSB_INTEL ||
+	    id->driver_info & BTUSB_INTEL_NEW) {
 
-	if (id->driver_info & BTUSB_INTEL) {
 		hdev->manufacturer = 2;
-		hdev->setup = btusb_setup_intel;
-		hdev->shutdown = btusb_shutdown_intel;
-		hdev->set_diag = btintel_set_diag_mfg;
 		hdev->set_bdaddr = btintel_set_bdaddr;
 		set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks);
 		set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);
 		set_bit(HCI_QUIRK_NON_PERSISTENT_DIAG, &hdev->quirks);
-	}
 
-	if (id->driver_info & BTUSB_INTEL_NEW) {
-		hdev->manufacturer = 2;
-		hdev->send = btusb_send_frame_intel;
-		hdev->setup = btusb_setup_intel_new;
-		hdev->hw_error = btintel_hw_error;
-		hdev->set_diag = btintel_set_diag;
-		hdev->set_bdaddr = btintel_set_bdaddr;
-		set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks);
-		set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);
-		set_bit(HCI_QUIRK_NON_PERSISTENT_DIAG, &hdev->quirks);
+		if (id->driver_info & BTUSB_INTEL) {
+			hdev->setup = btusb_setup_intel;
+			hdev->shutdown = btusb_shutdown_intel;
+			hdev->set_diag = btintel_set_diag_mfg;
+		} else {
+			hdev->send = btusb_send_frame_intel;
+			hdev->setup = btusb_setup_intel_new;
+			hdev->hw_error = btintel_hw_error;
+			hdev->set_diag = btintel_set_diag;
+		}
 	}
 
 	if (id->driver_info & BTUSB_MARVELL)