All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Feng Liu <feliu@nvidia.com>
Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>,
	Jiri Pirko <jiri@nvidia.com>,
	linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org
Subject: Re: [PATCH v1] virtio-pci: Improve code style for including header files
Date: Tue, 30 May 2023 11:18:46 -0400	[thread overview]
Message-ID: <20230530111818-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <9d183df9-7047-0eee-b6d4-b0f9b8d21036@nvidia.com>

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)
> > 

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Feng Liu <feliu@nvidia.com>
Cc: virtualization@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org, Jason Wang <jasowang@redhat.com>,
	Xuan Zhuo <xuanzhuo@linux.alibaba.com>,
	Jiri Pirko <jiri@nvidia.com>
Subject: Re: [PATCH v1] virtio-pci: Improve code style for including header files
Date: Tue, 30 May 2023 11:18:46 -0400	[thread overview]
Message-ID: <20230530111818-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <9d183df9-7047-0eee-b6d4-b0f9b8d21036@nvidia.com>

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)
> > 


  reply	other threads:[~2023-05-30 15:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-29 18:17 [PATCH v1] virtio-pci: Improve code style for including header files Feng Liu via Virtualization
2023-05-29 18:17 ` Feng Liu
2023-05-30 11:27 ` Michael S. Tsirkin
2023-05-30 11:27   ` Michael S. Tsirkin
2023-05-30 14:07   ` Feng Liu via Virtualization
2023-05-30 14:07     ` Feng Liu
2023-05-30 15:18     ` Michael S. Tsirkin [this message]
2023-05-30 15:18       ` Michael S. Tsirkin
2023-05-30 21:24       ` Feng Liu via Virtualization
2023-05-30 21:24         ` Feng Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230530111818-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=feliu@nvidia.com \
    --cc=jiri@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=xuanzhuo@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.