From patchwork Thu Dec 1 21:51:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9457075 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 973D060585 for ; Thu, 1 Dec 2016 21:52:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 88B7828533 for ; Thu, 1 Dec 2016 21:52:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D47B28539; Thu, 1 Dec 2016 21:52:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 105D528533 for ; Thu, 1 Dec 2016 21:52:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759903AbcLAVwM (ORCPT ); Thu, 1 Dec 2016 16:52:12 -0500 Received: from mout.kundenserver.de ([217.72.192.73]:49869 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750847AbcLAVwJ (ORCPT ); Thu, 1 Dec 2016 16:52:09 -0500 Received: from wuerfel.lan ([78.43.21.235]) by mrelayeu.kundenserver.de (mreue104 [212.227.15.145]) with ESMTPA (Nemesis) id 0MV5B7-1cBp5Q11pd-00YTus; Thu, 01 Dec 2016 22:51:53 +0100 From: Arnd Bergmann To: Mugunthan V N Cc: Arnd Bergmann , Grygorii Strashko , "David S. Miller" , Ivan Khoronzhuk , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , linux-omap@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] net: ethernet: ti: davinci_cpdma: sanitize inter-module API Date: Thu, 1 Dec 2016 22:51:27 +0100 Message-Id: <20161201215150.320245-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:xPjNHeAZXrl5Popv+MjdWx6DFyBXByRFbVEtfyuEy71HUy2VfdM zFMVgSvUXBxYYirEaoDnP9Q9v+zETS3kvcghak4YHWFwJx45/syf6kwzuaq0FHHnfspbZMg YUtAkqMSyDNDrTd/JXMfyFvYykDyiNCtUmSiKWHQntgbAR2caMvN7y6QgLqtaF5gvoXDtM1 6zpPKd10FX1Eh+ZK169fQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:Du0w5dy48kw=:3BKMYUKBhpSvfl+euVDv/s iDI8k0KOd6bjyVtGwLryA/xE0SsV1Y4NtDDzKxK07sJimKxhAId9+RmI9+4NuBaZbzM9NwUlH ukRfZJjBfvliMzc/KQI0ikpP+a5+9WpFt+b9lYvhlEFRNAlh+oXSKitbwc4MYFHXZw2jWzd/O DX1DzhhtXNhrrsXCLF+Qyx69qmSJ1XA4GVk3C0ELJRobGFNBHdFbcpdsF1cm9ukUTkXHFaaJn jjpvsMZ9u7mO2iEcEzkMSEljKx6+yA6aw0NTeyS7yA37V+631MghcnhkJ8lv2BrmNHnYtMOtp m4A9F/PjwO7DfENkU+e8Bcf7aIu0EsmgrDJNdwybJj0IyKc0IENz7iN67qIe8ZHJKBauy7hL7 Bd5IC0l9wRJAAApt/ai8GMMZMFrW4zARH+5VHk5XwLf/KplQX3Fa8JfAcBxpCq/p5Nc9Nie84 CHbN+CAkzt/hLs/Aw+oJyd2+KHfmDzPymSSUvdQk2kcXkFz8ipvm+RjMxvEztadYmlsLi8lIk kle3cVTFJDu10uQyaPHWSweIe+p/tFX4VJW/yMquADv/wKm+RCPhI8MQ4wENZgovwOr4Uan/y Wy8UpI3eXt2DRBqfv5hBzr3theNxP37BPpTtDTLX9ndnNdpRH+WseA7nh+SyN46L6ZC+Z7JBG W0/5KtdUmod8dtxL3jy2H7Q5mCYcJlUro6lrpP/qQxMEWfg+wa7P6v/xGN0bmRGbiDDs= Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The davinci_cpdma module is a helper library that is used by the actual device drivers and does nothing by itself, so all its API functions need to be exported. Four new functions were added recently without an export, so now we get a build error: ERROR: "cpdma_chan_set_weight" [drivers/net/ethernet/ti/ti_cpsw.ko] undefined! ERROR: "cpdma_chan_get_rate" [drivers/net/ethernet/ti/ti_cpsw.ko] undefined! ERROR: "cpdma_chan_get_min_rate" [drivers/net/ethernet/ti/ti_cpsw.ko] undefined! ERROR: "cpdma_chan_set_rate" [drivers/net/ethernet/ti/ti_cpsw.ko] undefined! This exports those symbols. After taking a closer look, I found two more global functions in this file that are not exported and not used anywhere, so they can obviously be removed. There is also one function that is only used internally in this module, and should be 'static'. Fixes: 8f32b90981dc ("net: ethernet: ti: davinci_cpdma: add set rate for a channel") Fixes: 0fc6432cc78d ("net: ethernet: ti: davinci_cpdma: add weight function for channels") Signed-off-by: Arnd Bergmann --- drivers/net/ethernet/ti/davinci_cpdma.c | 63 +++++++++++---------------------- drivers/net/ethernet/ti/davinci_cpdma.h | 4 --- 2 files changed, 21 insertions(+), 46 deletions(-) diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c index c776e4575d2d..b9d40f0cdf6c 100644 --- a/drivers/net/ethernet/ti/davinci_cpdma.c +++ b/drivers/net/ethernet/ti/davinci_cpdma.c @@ -628,6 +628,23 @@ int cpdma_ctlr_destroy(struct cpdma_ctlr *ctlr) } EXPORT_SYMBOL_GPL(cpdma_ctlr_destroy); +static int cpdma_chan_int_ctrl(struct cpdma_chan *chan, bool enable) +{ + unsigned long flags; + + spin_lock_irqsave(&chan->lock, flags); + if (chan->state != CPDMA_STATE_ACTIVE) { + spin_unlock_irqrestore(&chan->lock, flags); + return -EINVAL; + } + + dma_reg_write(chan->ctlr, enable ? chan->int_set : chan->int_clear, + chan->mask); + spin_unlock_irqrestore(&chan->lock, flags); + + return 0; +} + int cpdma_ctlr_int_ctrl(struct cpdma_ctlr *ctlr, bool enable) { unsigned long flags; @@ -796,6 +813,7 @@ int cpdma_chan_set_weight(struct cpdma_chan *ch, int weight) spin_unlock_irqrestore(&ctlr->lock, flags); return ret; } +EXPORT_SYMBOL_GPL(cpdma_chan_set_weight); /* cpdma_chan_get_min_rate - get minimum allowed rate for channel * Should be called before cpdma_chan_set_rate. @@ -810,6 +828,7 @@ u32 cpdma_chan_get_min_rate(struct cpdma_ctlr *ctlr) return DIV_ROUND_UP(divident, divisor); } +EXPORT_SYMBOL_GPL(cpdma_chan_get_min_rate); /* cpdma_chan_set_rate - limits bandwidth for transmit channel. * The bandwidth * limited channels have to be in order beginning from lowest. @@ -853,6 +872,7 @@ int cpdma_chan_set_rate(struct cpdma_chan *ch, u32 rate) spin_unlock_irqrestore(&ctlr->lock, flags); return ret; } +EXPORT_SYMBOL_GPL(cpdma_chan_set_rate); u32 cpdma_chan_get_rate(struct cpdma_chan *ch) { @@ -865,6 +885,7 @@ u32 cpdma_chan_get_rate(struct cpdma_chan *ch) return rate; } +EXPORT_SYMBOL_GPL(cpdma_chan_get_rate); struct cpdma_chan *cpdma_chan_create(struct cpdma_ctlr *ctlr, int chan_num, cpdma_handler_fn handler, int rx_type) @@ -1270,46 +1291,4 @@ int cpdma_chan_stop(struct cpdma_chan *chan) } EXPORT_SYMBOL_GPL(cpdma_chan_stop); -int cpdma_chan_int_ctrl(struct cpdma_chan *chan, bool enable) -{ - unsigned long flags; - - spin_lock_irqsave(&chan->lock, flags); - if (chan->state != CPDMA_STATE_ACTIVE) { - spin_unlock_irqrestore(&chan->lock, flags); - return -EINVAL; - } - - dma_reg_write(chan->ctlr, enable ? chan->int_set : chan->int_clear, - chan->mask); - spin_unlock_irqrestore(&chan->lock, flags); - - return 0; -} - -int cpdma_control_get(struct cpdma_ctlr *ctlr, int control) -{ - unsigned long flags; - int ret; - - spin_lock_irqsave(&ctlr->lock, flags); - ret = _cpdma_control_get(ctlr, control); - spin_unlock_irqrestore(&ctlr->lock, flags); - - return ret; -} - -int cpdma_control_set(struct cpdma_ctlr *ctlr, int control, int value) -{ - unsigned long flags; - int ret; - - spin_lock_irqsave(&ctlr->lock, flags); - ret = _cpdma_control_set(ctlr, control, value); - spin_unlock_irqrestore(&ctlr->lock, flags); - - return ret; -} -EXPORT_SYMBOL_GPL(cpdma_control_set); - MODULE_LICENSE("GPL"); diff --git a/drivers/net/ethernet/ti/davinci_cpdma.h b/drivers/net/ethernet/ti/davinci_cpdma.h index 4a167db2abab..36d0a09a3d44 100644 --- a/drivers/net/ethernet/ti/davinci_cpdma.h +++ b/drivers/net/ethernet/ti/davinci_cpdma.h @@ -87,7 +87,6 @@ int cpdma_chan_process(struct cpdma_chan *chan, int quota); int cpdma_ctlr_int_ctrl(struct cpdma_ctlr *ctlr, bool enable); void cpdma_ctlr_eoi(struct cpdma_ctlr *ctlr, u32 value); -int cpdma_chan_int_ctrl(struct cpdma_chan *chan, bool enable); u32 cpdma_ctrl_rxchs_state(struct cpdma_ctlr *ctlr); u32 cpdma_ctrl_txchs_state(struct cpdma_ctlr *ctlr); bool cpdma_check_free_tx_desc(struct cpdma_chan *chan); @@ -111,7 +110,4 @@ enum cpdma_control { CPDMA_RX_BUFFER_OFFSET, /* read-write */ }; -int cpdma_control_get(struct cpdma_ctlr *ctlr, int control); -int cpdma_control_set(struct cpdma_ctlr *ctlr, int control, int value); - #endif