From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751714AbdGZDV4 (ORCPT ); Tue, 25 Jul 2017 23:21:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56083 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751354AbdGZDVy (ORCPT ); Tue, 25 Jul 2017 23:21:54 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6663880F94 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jasowang@redhat.com Subject: Re: [PATCH net-next] virtio-net: mark PM functions as __maybe_unused To: Arnd Bergmann , "Michael S. Tsirkin" Cc: "David S. Miller" , John Fastabend , Willem de Bruijn , Sebastian Andrzej Siewior , Eric Dumazet , virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20170725153600.211694-1-arnd@arndb.de> From: Jason Wang Message-ID: <964aa12c-37cc-749f-e4a2-abb26d953517@redhat.com> Date: Wed, 26 Jul 2017 11:21:46 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170725153600.211694-1-arnd@arndb.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 26 Jul 2017 03:21:54 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2017年07月25日 23:35, Arnd Bergmann wrote: > After removing the reset function, the freeze and restore functions > are now unused when CONFIG_PM_SLEEP is disabled: > > drivers/net/virtio_net.c:1881:12: error: 'virtnet_restore_up' defined but not used [-Werror=unused-function] > static int virtnet_restore_up(struct virtio_device *vdev) > drivers/net/virtio_net.c:1859:13: error: 'virtnet_freeze_down' defined but not used [-Werror=unused-function] > static void virtnet_freeze_down(struct virtio_device *vdev) > > A more robust way to do this is to remove the #ifdef around the callers > and instead mark them as __maybe_unused. The compiler will now just > silently drop the unused code. > > Fixes: 4941d472bf95 ("virtio-net: do not reset during XDP set") > Signed-off-by: Arnd Bergmann > --- > drivers/net/virtio_net.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > index d4751ce23b4f..1902701e15a9 100644 > --- a/drivers/net/virtio_net.c > +++ b/drivers/net/virtio_net.c > @@ -2702,8 +2702,7 @@ static void virtnet_remove(struct virtio_device *vdev) > free_netdev(vi->dev); > } > > -#ifdef CONFIG_PM_SLEEP > -static int virtnet_freeze(struct virtio_device *vdev) > +static __maybe_unused int virtnet_freeze(struct virtio_device *vdev) > { > struct virtnet_info *vi = vdev->priv; > > @@ -2714,7 +2713,7 @@ static int virtnet_freeze(struct virtio_device *vdev) > return 0; > } > > -static int virtnet_restore(struct virtio_device *vdev) > +static __maybe_unused int virtnet_restore(struct virtio_device *vdev) > { > struct virtnet_info *vi = vdev->priv; > int err; > @@ -2730,7 +2729,6 @@ static int virtnet_restore(struct virtio_device *vdev) > > return 0; > } > -#endif > > static struct virtio_device_id id_table[] = { > { VIRTIO_ID_NET, VIRTIO_DEV_ANY_ID }, Acked-by: Jason Wang