[PATCH 33/63] net/can: Rename TYPE_CAN_CPI constants

Eduardo Habkost posted 63 patches 5 years, 2 months ago
[PATCH 33/63] net/can: Rename TYPE_CAN_CPI constants
Posted by Eduardo Habkost 5 years, 2 months ago
Rename macros to names that are unique in the source tree, to
reduce confusion and make automated conversion of the code
easier.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: Jason Wang <jasowang@redhat.com>
Cc: qemu-devel@nongnu.org
---
 hw/net/can/can_kvaser_pci.c   | 6 +++---
 hw/net/can/can_mioe3680_pci.c | 6 +++---
 hw/net/can/can_pcm3680_pci.c  | 6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/hw/net/can/can_kvaser_pci.c b/hw/net/can/can_kvaser_pci.c
index 168b3a620d..12d4f8df33 100644
--- a/hw/net/can/can_kvaser_pci.c
+++ b/hw/net/can/can_kvaser_pci.c
@@ -45,11 +45,11 @@
 #include "can_sja1000.h"
 #include "qom/object.h"
 
-#define TYPE_CAN_PCI_DEV "kvaser_pci"
+#define TYPE_KVASER_PCI "kvaser_pci"
 
 typedef struct KvaserPCIState KvaserPCIState;
 DECLARE_INSTANCE_CHECKER(KvaserPCIState, KVASER_PCI_DEV,
-                         TYPE_CAN_PCI_DEV)
+                         TYPE_KVASER_PCI)
 
 #ifndef KVASER_PCI_VENDOR_ID1
 #define KVASER_PCI_VENDOR_ID1     0x10e8    /* the PCI device and vendor IDs */
@@ -305,7 +305,7 @@ static void kvaser_pci_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo kvaser_pci_info = {
-    .name          = TYPE_CAN_PCI_DEV,
+    .name          = TYPE_KVASER_PCI,
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(KvaserPCIState),
     .class_init    = kvaser_pci_class_init,
diff --git a/hw/net/can/can_mioe3680_pci.c b/hw/net/can/can_mioe3680_pci.c
index 7a79e2605a..b20e5451bf 100644
--- a/hw/net/can/can_mioe3680_pci.c
+++ b/hw/net/can/can_mioe3680_pci.c
@@ -41,11 +41,11 @@
 #include "can_sja1000.h"
 #include "qom/object.h"
 
-#define TYPE_CAN_PCI_DEV "mioe3680_pci"
+#define TYPE_MIOE3680_PCI "mioe3680_pci"
 
 typedef struct Mioe3680PCIState Mioe3680PCIState;
 DECLARE_INSTANCE_CHECKER(Mioe3680PCIState, MIOe3680_PCI_DEV,
-                         TYPE_CAN_PCI_DEV)
+                         TYPE_MIOE3680_PCI)
 
 /* the PCI device and vendor IDs */
 #ifndef MIOe3680_PCI_VENDOR_ID1
@@ -248,7 +248,7 @@ static void mioe3680_pci_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo mioe3680_pci_info = {
-    .name          = TYPE_CAN_PCI_DEV,
+    .name          = TYPE_MIOE3680_PCI,
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(Mioe3680PCIState),
     .class_init    = mioe3680_pci_class_init,
diff --git a/hw/net/can/can_pcm3680_pci.c b/hw/net/can/can_pcm3680_pci.c
index 8ef4e74af0..530cd04a5d 100644
--- a/hw/net/can/can_pcm3680_pci.c
+++ b/hw/net/can/can_pcm3680_pci.c
@@ -41,11 +41,11 @@
 #include "can_sja1000.h"
 #include "qom/object.h"
 
-#define TYPE_CAN_PCI_DEV "pcm3680_pci"
+#define TYPE_PCM3680_PCI "pcm3680_pci"
 
 typedef struct Pcm3680iPCIState Pcm3680iPCIState;
 DECLARE_INSTANCE_CHECKER(Pcm3680iPCIState, PCM3680i_PCI_DEV,
-                         TYPE_CAN_PCI_DEV)
+                         TYPE_PCM3680_PCI)
 
 /* the PCI device and vendor IDs */
 #ifndef PCM3680i_PCI_VENDOR_ID1
@@ -249,7 +249,7 @@ static void pcm3680i_pci_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo pcm3680i_pci_info = {
-    .name          = TYPE_CAN_PCI_DEV,
+    .name          = TYPE_PCM3680_PCI,
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(Pcm3680iPCIState),
     .class_init    = pcm3680i_pci_class_init,
-- 
2.26.2


Re: [PATCH 33/63] net/can: Rename TYPE_CAN_CPI constants
Posted by Philippe Mathieu-Daudé 5 years, 2 months ago
On 9/3/20 12:42 AM, Eduardo Habkost wrote:
> Rename macros to names that are unique in the source tree, to
> reduce confusion and make automated conversion of the code
> easier.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: qemu-devel@nongnu.org
> ---
>  hw/net/can/can_kvaser_pci.c   | 6 +++---
>  hw/net/can/can_mioe3680_pci.c | 6 +++---
>  hw/net/can/can_pcm3680_pci.c  | 6 +++---
>  3 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/hw/net/can/can_kvaser_pci.c b/hw/net/can/can_kvaser_pci.c
> index 168b3a620d..12d4f8df33 100644
> --- a/hw/net/can/can_kvaser_pci.c
> +++ b/hw/net/can/can_kvaser_pci.c
> @@ -45,11 +45,11 @@
>  #include "can_sja1000.h"
>  #include "qom/object.h"
>  
> -#define TYPE_CAN_PCI_DEV "kvaser_pci"
> +#define TYPE_KVASER_PCI "kvaser_pci"

Why keep "PCI" and not keep the "CAN" part?
To be consistent we should use both busses or none.

[...]


Re: [PATCH 33/63] net/can: Rename TYPE_CAN_CPI constants
Posted by Eduardo Habkost 5 years, 2 months ago
On Thu, Sep 03, 2020 at 02:59:00PM +0200, Philippe Mathieu-Daudé wrote:
> On 9/3/20 12:42 AM, Eduardo Habkost wrote:
> > Rename macros to names that are unique in the source tree, to
> > reduce confusion and make automated conversion of the code
> > easier.
> > 
> > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> > ---
> > Cc: Jason Wang <jasowang@redhat.com>
> > Cc: qemu-devel@nongnu.org
> > ---
> >  hw/net/can/can_kvaser_pci.c   | 6 +++---
> >  hw/net/can/can_mioe3680_pci.c | 6 +++---
> >  hw/net/can/can_pcm3680_pci.c  | 6 +++---
> >  3 files changed, 9 insertions(+), 9 deletions(-)
> > 
> > diff --git a/hw/net/can/can_kvaser_pci.c b/hw/net/can/can_kvaser_pci.c
> > index 168b3a620d..12d4f8df33 100644
> > --- a/hw/net/can/can_kvaser_pci.c
> > +++ b/hw/net/can/can_kvaser_pci.c
> > @@ -45,11 +45,11 @@
> >  #include "can_sja1000.h"
> >  #include "qom/object.h"
> >  
> > -#define TYPE_CAN_PCI_DEV "kvaser_pci"
> > +#define TYPE_KVASER_PCI "kvaser_pci"
> 
> Why keep "PCI" and not keep the "CAN" part?
> To be consistent we should use both busses or none.

Because the type name is "kvaser_pci", the device state struct is
called KVaserPCIState, the type checking macro is called
KVASER_PCI_DEV, and most functions inside that file are called
kvaser_pci_*().

-- 
Eduardo