Re: [PATCH 7/9] can: softing: add DRV_NAME to replace hardcoded names

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

 



On 26.07.2022 00:31:22, Vincent Mailhol wrote:
> The driver uses the string "kvaser_usb" to populate
> usb_driver::name. Add a new macro DRV_NAME which evaluates to
> "ems_ubs" and then use DRV_NAME and to get rid on the hardcoded string
> names.
> 
> Signed-off-by: Vincent Mailhol <mailhol.vincent@xxxxxxxxxx>
> ---
>  drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c b/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c
> index f211bfcb1d97..a6cff8da5a41 100644
> --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c
> +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c
> @@ -29,6 +29,8 @@
>  
>  #include "kvaser_usb.h"
>  
> +#define DRV_NAME "kvaser_usb"
> +
>  /* Kvaser USB vendor id. */
>  #define KVASER_VENDOR_ID			0x0bfd
>  
> @@ -869,7 +871,7 @@ static void kvaser_usb_disconnect(struct usb_interface *intf)
>  }
>  
>  static struct usb_driver kvaser_usb_driver = {
> -	.name = "kvaser_usb",
> +	.name = DRV_NAME,
>  	.probe = kvaser_usb_probe,
>  	.disconnect = kvaser_usb_disconnect,
>  	.id_table = kvaser_usb_table,

KBUILD_MODNAME works here, too. I just checked with:

| make drivers/net/can/usb/kvaser_usb/kvaser_usb_core.i
| grep -A5 "struct usb_driver kvaser_usb_driver" drivers/net/can/usb/kvaser_usb/kvaser_usb_core.i
| static struct usb_driver kvaser_usb_driver = {
|  .name = "kvaser_usb",
|  .probe = kvaser_usb_probe,
|  .disconnect = kvaser_usb_disconnect,
|  .id_table = kvaser_usb_table,
| };

Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux