Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp193235imb; Thu, 28 Feb 2019 20:51:43 -0800 (PST) X-Google-Smtp-Source: APXvYqyC99PjZLSG7o9uHRHIRBGdS6ImcqunNgNrBhINqYI+szRVlR9Z/fAjcUdXpTvvG3JOz6JC X-Received: by 2002:a63:9149:: with SMTP id l70mr2977167pge.65.1551415903536; Thu, 28 Feb 2019 20:51:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551415903; cv=none; d=google.com; s=arc-20160816; b=QhViWv4Kr977F0zdUED9SIPWH3yP9hGEsMTJgZWUck42DnGrvk93NEYcSRnZn9soR9 Qp5X0DOOw3mc0UyFzhgSPe/Cj3qEMSG+KIYWkhuIPuqXpt34EwabiL6T59I/w6Qt21sH lI9iv5LWlJ7ThmO0fju7z143gi9mTD6wtT8+MswMH1c75Q/6S3KkjaxcS3XEAh2tx8xd PJvXd1u3OdsYoNkIOl7v9PvyWrZFBcZHzY9SNGn9Acc3lcGrXWn/Ii2p1Irrb2O7MskH 3+9rDvO7q3pYVQg0+3RiaUHMtkjBEh4sQJA5jeKpJW6jb8l3n1DU2UmiJ+oybWYqaAKm V/eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=YJ+blb3Z/vIrzqZfiH4iPXW2OEwqdX41qNd6u5sMp04=; b=I81tv+fXq3hoj7zNKDykAnCDo+f2vy7/u6G9mNwbyU3jOhVUt2aZj+zjTr78omhFim 2TXUcydbLnW8OWsdmRUBSycjU+wJuFlt/sbAYUQN5CcypSUwOrrlxdJ3LlsdKSVtPS/q ODjdSGFbxB62H2RXyHRZep1wXYLry17z5aEzJfwHsQfPFQE8rjpRzvclzCklFifezdZd e0rBf5X1/xZE1K0aZjmCjby4fQRZ/0B8cri667IfcpqrvwaD8BTQVfaCXrLu+l3reXuy YBGzIt/eVrilDcihWqd2f6vDVOSlXl5EVuQa/hGV2oc2XJtMNIFf5OJboJV3u/sJrF4u XLiQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a18si13897481pfc.23.2019.02.28.20.51.25; Thu, 28 Feb 2019 20:51:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730134AbfCAEiU (ORCPT + 99 others); Thu, 28 Feb 2019 23:38:20 -0500 Received: from smtprelay0045.hostedemail.com ([216.40.44.45]:58211 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726347AbfCAEiU (ORCPT ); Thu, 28 Feb 2019 23:38:20 -0500 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay04.hostedemail.com (Postfix) with ESMTP id A5536180A8142; Fri, 1 Mar 2019 04:38:18 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::,RULES_HIT:2:41:69:355:379:800:960:968:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1535:1593:1594:1606:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3355:3865:3867:3868:3871:4117:4321:4605:5007:6119:7903:8603:8957:9592:10004:10848:11026:11473:11658:11914:12043:12296:12438:12555:12710:12737:12760:12895:12986:13439:14196:14394:14659:21080:21451:21611:21627:30054:30060,0,RBL:47.151.153.53:@perches.com:.lbl8.mailshell.net-62.8.0.100 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:30,LUA_SUMMARY:none X-HE-Tag: iron22_e2f37b8d995d X-Filterd-Recvd-Size: 6531 Received: from XPS-9350.home (unknown [47.151.153.53]) (Authenticated sender: joe@perches.com) by omf10.hostedemail.com (Postfix) with ESMTPA; Fri, 1 Mar 2019 04:38:17 +0000 (UTC) Message-ID: <3f515cdb5cb6f77acb5cd8029bacd0be782eed64.camel@perches.com> Subject: [PATCH] wusb: Remove unnecessary static function ckhdid_printf From: Joe Perches To: Jon Flatley Cc: Louis Taylor , gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, Linux Kernel Mailing List , clang-built-linux@googlegroups.com, Nick Desaulniers Date: Thu, 28 Feb 2019 20:38:16 -0800 In-Reply-To: References: <20190228115256.5446-1-louis@kragniz.eu> <20190228122417.9318-1-louis@kragniz.eu> <15c6689389503a82394bccb9204650bf20a7a6d3.camel@perches.com> <1450785b937f4a2b5f98c8548986b162684a719b.camel@perches.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.30.1-1build1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This static inline is unnecessary and can be removed by using the vsprintf %ph extension. This reduces overall object size by more than 2K. Signed-off-by: Joe Perches --- drivers/usb/wusbcore/cbaf.c | 15 ++++----------- drivers/usb/wusbcore/dev-sysfs.c | 5 ++--- drivers/usb/wusbcore/devconnect.c | 2 +- drivers/usb/wusbcore/wusbhc.c | 6 +----- include/linux/usb/wusb.h | 16 ---------------- 5 files changed, 8 insertions(+), 36 deletions(-) diff --git a/drivers/usb/wusbcore/cbaf.c b/drivers/usb/wusbcore/cbaf.c index 222228c5c1e1..af77064c7456 100644 --- a/drivers/usb/wusbcore/cbaf.c +++ b/drivers/usb/wusbcore/cbaf.c @@ -302,10 +302,8 @@ static ssize_t cbaf_wusb_chid_show(struct device *dev, { struct usb_interface *iface = to_usb_interface(dev); struct cbaf *cbaf = usb_get_intfdata(iface); - char pr_chid[WUSB_CKHDID_STRSIZE]; - ckhdid_printf(pr_chid, sizeof(pr_chid), &cbaf->chid); - return scnprintf(buf, PAGE_SIZE, "%s\n", pr_chid); + return sprintf(buf, "%16ph\n", cbaf->chid.data); } static ssize_t cbaf_wusb_chid_store(struct device *dev, @@ -415,10 +413,8 @@ static ssize_t cbaf_wusb_cdid_show(struct device *dev, { struct usb_interface *iface = to_usb_interface(dev); struct cbaf *cbaf = usb_get_intfdata(iface); - char pr_cdid[WUSB_CKHDID_STRSIZE]; - ckhdid_printf(pr_cdid, sizeof(pr_cdid), &cbaf->cdid); - return scnprintf(buf, PAGE_SIZE, "%s\n", pr_cdid); + return sprintf(buf, "%16ph\n", cbaf->cdid.data); } static ssize_t cbaf_wusb_cdid_store(struct device *dev, @@ -503,7 +499,6 @@ static int cbaf_cc_upload(struct cbaf *cbaf) int result; struct device *dev = &cbaf->usb_iface->dev; struct wusb_cbaf_cc_data *ccd; - char pr_cdid[WUSB_CKHDID_STRSIZE]; ccd = cbaf->buffer; *ccd = cbaf_cc_data_defaults; @@ -513,10 +508,8 @@ static int cbaf_cc_upload(struct cbaf *cbaf) ccd->BandGroups = cpu_to_le16(cbaf->host_band_groups); dev_dbg(dev, "Trying to upload CC:\n"); - ckhdid_printf(pr_cdid, sizeof(pr_cdid), &ccd->CHID); - dev_dbg(dev, " CHID %s\n", pr_cdid); - ckhdid_printf(pr_cdid, sizeof(pr_cdid), &ccd->CDID); - dev_dbg(dev, " CDID %s\n", pr_cdid); + dev_dbg(dev, " CHID %16ph\n", ccd->CHID.data); + dev_dbg(dev, " CDID %16ph\n", ccd->CDID.data); dev_dbg(dev, " Bandgroups 0x%04x\n", cbaf->host_band_groups); result = usb_control_msg( diff --git a/drivers/usb/wusbcore/dev-sysfs.c b/drivers/usb/wusbcore/dev-sysfs.c index 85a1acf3a729..67b0a4c412b2 100644 --- a/drivers/usb/wusbcore/dev-sysfs.c +++ b/drivers/usb/wusbcore/dev-sysfs.c @@ -50,10 +50,9 @@ static ssize_t wusb_cdid_show(struct device *dev, wusb_dev = wusb_dev_get_by_usb_dev(to_usb_device(dev)); if (wusb_dev == NULL) return -ENODEV; - result = ckhdid_printf(buf, PAGE_SIZE, &wusb_dev->cdid); - strcat(buf, "\n"); + result = sprintf(buf, "%16ph\n", wusb_dev->cdid.data); wusb_dev_put(wusb_dev); - return result + 1; + return result; } static DEVICE_ATTR_RO(wusb_cdid); diff --git a/drivers/usb/wusbcore/devconnect.c b/drivers/usb/wusbcore/devconnect.c index fcb06aef2675..a93837d57d53 100644 --- a/drivers/usb/wusbcore/devconnect.c +++ b/drivers/usb/wusbcore/devconnect.c @@ -532,7 +532,7 @@ static void wusbhc_handle_dn_connect(struct wusbhc *wusbhc, } dnc = container_of(dn_hdr, struct wusb_dn_connect, hdr); - ckhdid_printf(pr_cdid, sizeof(pr_cdid), &dnc->CDID); + sprintf(pr_cdid, "%16ph", dnc->CDID.data); dev_info(dev, "DN CONNECT: device %s @ %x (%s) wants to %s\n", pr_cdid, wusb_dn_connect_prev_dev_addr(dnc), diff --git a/drivers/usb/wusbcore/wusbhc.c b/drivers/usb/wusbcore/wusbhc.c index e5ba6140c1ba..d0b404d258e8 100644 --- a/drivers/usb/wusbcore/wusbhc.c +++ b/drivers/usb/wusbcore/wusbhc.c @@ -80,17 +80,13 @@ static ssize_t wusb_chid_show(struct device *dev, { struct wusbhc *wusbhc = usbhc_dev_to_wusbhc(dev); const struct wusb_ckhdid *chid; - ssize_t result = 0; if (wusbhc->wuie_host_info != NULL) chid = &wusbhc->wuie_host_info->CHID; else chid = &wusb_ckhdid_zero; - result += ckhdid_printf(buf, PAGE_SIZE, chid); - result += sprintf(buf + result, "\n"); - - return result; + return sprintf(buf, "%16ph\n", chid->data); } /* diff --git a/include/linux/usb/wusb.h b/include/linux/usb/wusb.h index 9e4a3213f2c2..65adee629106 100644 --- a/include/linux/usb/wusb.h +++ b/include/linux/usb/wusb.h @@ -236,22 +236,6 @@ enum { WUSB_TRUST_TIMEOUT_MS = 4000, /* [WUSB] section 4.15.1 */ }; -static inline size_t ckhdid_printf(char *pr_ckhdid, size_t size, - const struct wusb_ckhdid *ckhdid) -{ - return scnprintf(pr_ckhdid, size, - "%02hx %02hx %02hx %02hx %02hx %02hx %02hx %02hx " - "%02hx %02hx %02hx %02hx %02hx %02hx %02hx %02hx", - ckhdid->data[0], ckhdid->data[1], - ckhdid->data[2], ckhdid->data[3], - ckhdid->data[4], ckhdid->data[5], - ckhdid->data[6], ckhdid->data[7], - ckhdid->data[8], ckhdid->data[9], - ckhdid->data[10], ckhdid->data[11], - ckhdid->data[12], ckhdid->data[13], - ckhdid->data[14], ckhdid->data[15]); -} - /* * WUSB Crypto stuff (WUSB1.0[6]) */