public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] virtio-pci: Improve code style for including header files
@ 2023-05-29 18:17 Feng Liu
  2023-05-30 11:27 ` Michael S. Tsirkin
  0 siblings, 1 reply; 5+ messages in thread
From: Feng Liu @ 2023-05-29 18:17 UTC (permalink / raw)
  To: virtualization, linux-kernel
  Cc: Jason Wang, Michael S . Tsirkin, Xuan Zhuo, Feng Liu, Jiri Pirko

Fix code style related to including header file. Include header files
before declaring macro definitions to avoid conflicts.

Signed-off-by: Feng Liu <feliu@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
---
 drivers/virtio/virtio_pci_modern.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/virtio/virtio_pci_modern.c b/drivers/virtio/virtio_pci_modern.c
index d6bb68ba84e5..b21a489e0086 100644
--- a/drivers/virtio/virtio_pci_modern.c
+++ b/drivers/virtio/virtio_pci_modern.c
@@ -15,9 +15,10 @@
  */
 
 #include <linux/delay.h>
+#include "virtio_pci_common.h"
+
 #define VIRTIO_PCI_NO_LEGACY
 #define VIRTIO_RING_NO_LEGACY
-#include "virtio_pci_common.h"
 
 static u64 vp_get_features(struct virtio_device *vdev)
 {
-- 
2.37.1 (Apple Git-137.1)


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] virtio-pci: Improve code style for including header files
  2023-05-29 18:17 [PATCH v1] virtio-pci: Improve code style for including header files Feng Liu
@ 2023-05-30 11:27 ` Michael S. Tsirkin
  2023-05-30 14:07   ` Feng Liu
  0 siblings, 1 reply; 5+ messages in thread
From: Michael S. Tsirkin @ 2023-05-30 11:27 UTC (permalink / raw)
  To: Feng Liu; +Cc: virtualization, linux-kernel, Jason Wang, Xuan Zhuo, Jiri Pirko

On Mon, May 29, 2023 at 02:17:29PM -0400, Feng Liu wrote:
> Fix code style related to including header file. Include header files
> before declaring macro definitions to avoid conflicts.
> 
> Signed-off-by: Feng Liu <feliu@nvidia.com>
> Reviewed-by: Jiri Pirko <jiri@nvidia.com>

Which conflicts? These macros are there precisely to change
how the header behaves.

> ---
>  drivers/virtio/virtio_pci_modern.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/virtio/virtio_pci_modern.c b/drivers/virtio/virtio_pci_modern.c
> index d6bb68ba84e5..b21a489e0086 100644
> --- a/drivers/virtio/virtio_pci_modern.c
> +++ b/drivers/virtio/virtio_pci_modern.c
> @@ -15,9 +15,10 @@
>   */
>  
>  #include <linux/delay.h>
> +#include "virtio_pci_common.h"
> +
>  #define VIRTIO_PCI_NO_LEGACY
>  #define VIRTIO_RING_NO_LEGACY
> -#include "virtio_pci_common.h"
>  
>  static u64 vp_get_features(struct virtio_device *vdev)
>  {
> -- 
> 2.37.1 (Apple Git-137.1)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] virtio-pci: Improve code style for including header files
  2023-05-30 11:27 ` Michael S. Tsirkin
@ 2023-05-30 14:07   ` Feng Liu
  2023-05-30 15:18     ` Michael S. Tsirkin
  0 siblings, 1 reply; 5+ messages in thread
From: Feng Liu @ 2023-05-30 14:07 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: virtualization, linux-kernel, Jason Wang, Xuan Zhuo, Jiri Pirko



On 2023-05-30 a.m.7:27, Michael S. Tsirkin wrote:
> External email: Use caution opening links or attachments
> 
> 
> On Mon, May 29, 2023 at 02:17:29PM -0400, Feng Liu wrote:
>> Fix code style related to including header file. Include header files
>> before declaring macro definitions to avoid conflicts.
>>
>> Signed-off-by: Feng Liu <feliu@nvidia.com>
>> Reviewed-by: Jiri Pirko <jiri@nvidia.com>
> 
> Which conflicts? These macros are there precisely to change
> how the header behaves.
> 

Hi Michael
     I think including the header files should be placed before the 
macro definition.
     If VIRTIO_PCI_NO_LEGACY and VIRTIO_RING_NO_LEGACY are needed for 
control header file, we should put them at the beginning of 
virtio_pci_common.h.

What do you think?

>> ---
>>   drivers/virtio/virtio_pci_modern.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/virtio/virtio_pci_modern.c b/drivers/virtio/virtio_pci_modern.c
>> index d6bb68ba84e5..b21a489e0086 100644
>> --- a/drivers/virtio/virtio_pci_modern.c
>> +++ b/drivers/virtio/virtio_pci_modern.c
>> @@ -15,9 +15,10 @@
>>    */
>>
>>   #include <linux/delay.h>
>> +#include "virtio_pci_common.h"
>> +
>>   #define VIRTIO_PCI_NO_LEGACY
>>   #define VIRTIO_RING_NO_LEGACY
>> -#include "virtio_pci_common.h"
>>
>>   static u64 vp_get_features(struct virtio_device *vdev)
>>   {
>> --
>> 2.37.1 (Apple Git-137.1)
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] virtio-pci: Improve code style for including header files
  2023-05-30 14:07   ` Feng Liu
@ 2023-05-30 15:18     ` Michael S. Tsirkin
  2023-05-30 21:24       ` Feng Liu
  0 siblings, 1 reply; 5+ messages in thread
From: Michael S. Tsirkin @ 2023-05-30 15:18 UTC (permalink / raw)
  To: Feng Liu; +Cc: virtualization, linux-kernel, Jason Wang, Xuan Zhuo, Jiri Pirko

On Tue, May 30, 2023 at 10:07:23AM -0400, Feng Liu wrote:
> 
> 
> On 2023-05-30 a.m.7:27, Michael S. Tsirkin wrote:
> > External email: Use caution opening links or attachments
> > 
> > 
> > On Mon, May 29, 2023 at 02:17:29PM -0400, Feng Liu wrote:
> > > Fix code style related to including header file. Include header files
> > > before declaring macro definitions to avoid conflicts.
> > > 
> > > Signed-off-by: Feng Liu <feliu@nvidia.com>
> > > Reviewed-by: Jiri Pirko <jiri@nvidia.com>
> > 
> > Which conflicts? These macros are there precisely to change
> > how the header behaves.
> > 
> 
> Hi Michael
>     I think including the header files should be placed before the macro
> definition.
>     If VIRTIO_PCI_NO_LEGACY and VIRTIO_RING_NO_LEGACY are needed for control
> header file, we should put them at the beginning of virtio_pci_common.h.
> 
> What do you think?

I think you should read the code in question not make guesses.

> > > ---
> > >   drivers/virtio/virtio_pci_modern.c | 3 ++-
> > >   1 file changed, 2 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/virtio/virtio_pci_modern.c b/drivers/virtio/virtio_pci_modern.c
> > > index d6bb68ba84e5..b21a489e0086 100644
> > > --- a/drivers/virtio/virtio_pci_modern.c
> > > +++ b/drivers/virtio/virtio_pci_modern.c
> > > @@ -15,9 +15,10 @@
> > >    */
> > > 
> > >   #include <linux/delay.h>
> > > +#include "virtio_pci_common.h"
> > > +
> > >   #define VIRTIO_PCI_NO_LEGACY
> > >   #define VIRTIO_RING_NO_LEGACY
> > > -#include "virtio_pci_common.h"
> > > 
> > >   static u64 vp_get_features(struct virtio_device *vdev)
> > >   {
> > > --
> > > 2.37.1 (Apple Git-137.1)
> > 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] virtio-pci: Improve code style for including header files
  2023-05-30 15:18     ` Michael S. Tsirkin
@ 2023-05-30 21:24       ` Feng Liu
  0 siblings, 0 replies; 5+ messages in thread
From: Feng Liu @ 2023-05-30 21:24 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: virtualization, linux-kernel, Jason Wang, Xuan Zhuo, Jiri Pirko



On 2023-05-30 a.m.11:18, Michael S. Tsirkin wrote:
> External email: Use caution opening links or attachments
> 
> 
> On Tue, May 30, 2023 at 10:07:23AM -0400, Feng Liu wrote:
>>
>>
>> On 2023-05-30 a.m.7:27, Michael S. Tsirkin wrote:
>>> External email: Use caution opening links or attachments
>>>
>>>
>>> On Mon, May 29, 2023 at 02:17:29PM -0400, Feng Liu wrote:
>>>> Fix code style related to including header file. Include header files
>>>> before declaring macro definitions to avoid conflicts.
>>>>
>>>> Signed-off-by: Feng Liu <feliu@nvidia.com>
>>>> Reviewed-by: Jiri Pirko <jiri@nvidia.com>
>>>
>>> Which conflicts? These macros are there precisely to change
>>> how the header behaves.
>>>
>>
>> Hi Michael
>>      I think including the header files should be placed before the macro
>> definition.
>>      If VIRTIO_PCI_NO_LEGACY and VIRTIO_RING_NO_LEGACY are needed for control
>> header file, we should put them at the beginning of virtio_pci_common.h.
>>
>> What do you think?
> 
> I think you should read the code in question not make guesses.
> 
Okey. I see, thx

>>>> ---
>>>>    drivers/virtio/virtio_pci_modern.c | 3 ++-
>>>>    1 file changed, 2 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/virtio/virtio_pci_modern.c b/drivers/virtio/virtio_pci_modern.c
>>>> index d6bb68ba84e5..b21a489e0086 100644
>>>> --- a/drivers/virtio/virtio_pci_modern.c
>>>> +++ b/drivers/virtio/virtio_pci_modern.c
>>>> @@ -15,9 +15,10 @@
>>>>     */
>>>>
>>>>    #include <linux/delay.h>
>>>> +#include "virtio_pci_common.h"
>>>> +
>>>>    #define VIRTIO_PCI_NO_LEGACY
>>>>    #define VIRTIO_RING_NO_LEGACY
>>>> -#include "virtio_pci_common.h"
>>>>
>>>>    static u64 vp_get_features(struct virtio_device *vdev)
>>>>    {
>>>> --
>>>> 2.37.1 (Apple Git-137.1)
>>>
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-05-30 21:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-29 18:17 [PATCH v1] virtio-pci: Improve code style for including header files Feng Liu
2023-05-30 11:27 ` Michael S. Tsirkin
2023-05-30 14:07   ` Feng Liu
2023-05-30 15:18     ` Michael S. Tsirkin
2023-05-30 21:24       ` Feng Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox