From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751383AbdDACpQ (ORCPT ); Fri, 31 Mar 2017 22:45:16 -0400 Received: from smtprelay0073.hostedemail.com ([216.40.44.73]:46637 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751282AbdDACpP (ORCPT ); Fri, 31 Mar 2017 22:45:15 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 50,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::,RULES_HIT:41:69:196:355:379:541:599:800:901:960:966:967:968:973:988:989:1260:1263:1277:1311:1313:1314:1345:1359:1373:1381:1437:1515:1516:1518:1534:1542:1593:1594:1622:1711:1730:1747:1777:1792:2194:2196:2199:2200:2393:2525:2561:2564:2682:2685:2828:2859:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3354:3503:3504:3622:3865:3866:3867:3868:3870:3871:3872:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4321:4385:5007:6671:7903:8660:9025:9592:10004:10400:10848:11026:11232:11473:11658:11914:12043:12048:12296:12438:12555:12731:12737:12740:12760:12895:12986:13007:13025:13095:13148:13230:13439:14181:14659:14721:14849:21080:21433:21451:30029:30030:30046:30054:30080:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: spot75_678aea8efa632 X-Filterd-Recvd-Size: 3983 Message-ID: <1491014709.27353.29.camel@perches.com> Subject: Re: [PATCH 001/001] drivers/staging/vt6656/main_usb.c: checkpatch warning From: Joe Perches To: Randy Dunlap , Chewie Lin , greg@kroah.com, forest@alittletooquiet.net, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Date: Fri, 31 Mar 2017 19:45:09 -0700 In-Reply-To: <861e5179-270f-ce93-4d9c-9732945bf8c1@infradead.org> References: <20170401015919.9181-1-linsh@oregonstate.edu> <20170401015919.9181-2-linsh@oregonstate.edu> <861e5179-270f-ce93-4d9c-9732945bf8c1@infradead.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.3-0ubuntu0.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2017-03-31 at 19:15 -0700, Randy Dunlap wrote: > On 03/31/17 18:59, Chewie Lin wrote: > > Replace string with formatted arguments in the dev_warn() call. It removes > > the checkpatch warning: > > > > WARNING: Prefer using "%s", __func__ to embedded function names > > #417: FILE: main_usb.c:417: > > + "usb_device_reset fail status=%d\n", status); > > > > total: 0 errors, 1 warnings, 1058 lines checked > > > > And after fix: > > > > main_usb.c has no obvious style problems and is ready for submission. > > > > Signed-off-by: Chewie Lin > > --- > > drivers/staging/vt6656/main_usb.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c > > index 9e074e9..2d9e7af 100644 > > --- a/drivers/staging/vt6656/main_usb.c > > +++ b/drivers/staging/vt6656/main_usb.c > > @@ -414,7 +414,7 @@ static void usb_device_reset(struct vnt_private *priv) > > status = usb_reset_device(priv->usb); > > if (status) > > dev_warn(&priv->usb->dev, > > - "usb_device_reset fail status=%d\n", status); > > + "%s=%d\n", "usb_device_reset fail status", status); > > } > > > > static void vnt_free_int_bufs(struct vnt_private *priv) > > > > As other people have said: > > This function is usb_device_reset(). If that function name string is to be > used in the message, it should be done so by using __func__. > See http://marc.info/?l=linux-driver-devel&m=149095639202492&w=2 > > Or is the called (failing) function name is to be kept in the message (as it > is currently), then the message should contain "usb_reset_device" instead of > "usb_device_reset". See http://marc.info/?l=linux-driver-devel&m=149098680312723&w=2 If this is to be changed at all, I suggest just getting rid of the function. --- drivers/staging/vt6656/main_usb.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index 9e074e9daf4e..799aeeb6812d 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -407,16 +407,6 @@ static void vnt_free_rx_bufs(struct vnt_private *priv) } } -static void usb_device_reset(struct vnt_private *priv) -{ - int status; - - status = usb_reset_device(priv->usb); - if (status) - dev_warn(&priv->usb->dev, - "usb_device_reset fail status=%d\n", status); -} - static void vnt_free_int_bufs(struct vnt_private *priv) { kfree(priv->int_buf.data_buf); @@ -995,7 +985,9 @@ vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id) SET_IEEE80211_DEV(priv->hw, &intf->dev); - usb_device_reset(priv); + rc = usb_reset_device(priv->usb); + if (rc) + dev_warn(&priv->usb->dev, "usb_reset_device failed: %d\n", rc); clear_bit(DEVICE_FLAGS_DISCONNECTED, &priv->flags); vnt_reset_command_timer(priv);