netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jon Mason <jon.mason@intel.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	Dave Jiang <dave.jiang@intel.com>,
	Nicholas Bellinger <nab@linux-iscsi.org>
Subject: Re: [PATCH 14/21] NTB: Fix Sparse Warnings
Date: Mon, 21 Jan 2013 14:13:50 -0700	[thread overview]
Message-ID: <20130121211350.GH22208@jonmason-lab> (raw)
In-Reply-To: <20130120234534.GD14196@kroah.com>

On Sun, Jan 20, 2013 at 03:45:34PM -0800, Greg KH wrote:
> On Sat, Jan 19, 2013 at 02:02:28AM -0700, Jon Mason wrote:
> > Address the sparse warnings and resulting fallout
> > 
> > Signed-off-by: Jon Mason <jon.mason@intel.com>
> > ---
> >  drivers/ntb/ntb_hw.c        |    7 ++++---
> >  drivers/ntb/ntb_hw.h        |    4 ++--
> >  drivers/ntb/ntb_transport.c |   32 ++++++++++++++++----------------
> >  3 files changed, 22 insertions(+), 21 deletions(-)
> > 
> > diff --git a/drivers/ntb/ntb_hw.c b/drivers/ntb/ntb_hw.c
> > index 18cb5dc..b792ccd 100644
> > --- a/drivers/ntb/ntb_hw.c
> > +++ b/drivers/ntb/ntb_hw.c
> > @@ -104,8 +104,9 @@ MODULE_DEVICE_TABLE(pci, ntb_pci_tbl);
> >   *
> >   * RETURNS: An appropriate -ERRNO error value on error, or zero for success.
> >   */
> > -int ntb_register_event_callback(struct ntb_device *ndev,
> > -				void (*func)(void *handle, unsigned int event))
> > +int
> > +ntb_register_event_callback(struct ntb_device *ndev,
> > +			    void (*func)(void *handle, enum ntb_hw_event event))
> 
> What is sparse complaining about here that moving the function name to
> the start of the line fixes?  That shouldn't be necessary at all.  Ah,
> the enum?  If so, why change the first line at all?

All an effort to get it to fit in under 80 chars.

> 
> >  {
> >  	if (ndev->event_cb)
> >  		return -EINVAL;
> > @@ -344,7 +345,7 @@ int ntb_read_remote_spad(struct ntb_device *ndev, unsigned int idx, u32 *val)
> >   *
> >   * RETURNS: pointer to virtual address, or NULL on error.
> >   */
> > -void *ntb_get_mw_vbase(struct ntb_device *ndev, unsigned int mw)
> > +void __iomem *ntb_get_mw_vbase(struct ntb_device *ndev, unsigned int mw)
> 
> That makes sense to fix.
> 
> >  {
> >  	if (mw > NTB_NUM_MW)
> >  		return NULL;
> > diff --git a/drivers/ntb/ntb_hw.h b/drivers/ntb/ntb_hw.h
> > index 5e00951..3a3038c 100644
> > --- a/drivers/ntb/ntb_hw.h
> > +++ b/drivers/ntb/ntb_hw.h
> > @@ -165,14 +165,14 @@ int ntb_register_db_callback(struct ntb_device *ndev, unsigned int idx,
> >  void ntb_unregister_db_callback(struct ntb_device *ndev, unsigned int idx);
> >  int ntb_register_event_callback(struct ntb_device *ndev,
> >  				void (*event_cb_func) (void *handle,
> > -						       unsigned int event));
> > +						      enum ntb_hw_event event));
> >  void ntb_unregister_event_callback(struct ntb_device *ndev);
> >  int ntb_get_max_spads(struct ntb_device *ndev);
> >  int ntb_write_local_spad(struct ntb_device *ndev, unsigned int idx, u32 val);
> >  int ntb_read_local_spad(struct ntb_device *ndev, unsigned int idx, u32 *val);
> >  int ntb_write_remote_spad(struct ntb_device *ndev, unsigned int idx, u32 val);
> >  int ntb_read_remote_spad(struct ntb_device *ndev, unsigned int idx, u32 *val);
> > -void *ntb_get_mw_vbase(struct ntb_device *ndev, unsigned int mw);
> > +void __iomem *ntb_get_mw_vbase(struct ntb_device *ndev, unsigned int mw);
> >  resource_size_t ntb_get_mw_size(struct ntb_device *ndev, unsigned int mw);
> >  void ntb_ring_sdb(struct ntb_device *ndev, unsigned int idx);
> >  void *ntb_find_transport(struct pci_dev *pdev);
> > diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
> > index b3afb24..e0bdfd7 100644
> > --- a/drivers/ntb/ntb_transport.c
> > +++ b/drivers/ntb/ntb_transport.c
> > @@ -58,7 +58,7 @@
> >  #include <linux/ntb.h>
> >  #include "ntb_hw.h"
> >  
> > -#define NTB_TRANSPORT_VERSION	1
> > +#define NTB_TRANSPORT_VERSION	2
> 
> How is this a sparse fix?

I changed the format of the header below.

> 
> >  static unsigned int transport_mtu = 0x401E;
> >  module_param(transport_mtu, uint, 0644);
> > @@ -91,14 +91,14 @@ struct ntb_transport_qp {
> >  	bool qp_link;
> >  	u8 qp_num;	/* Only 64 QP's are allowed.  0-63 */
> >  
> > -	struct ntb_rx_info *rx_info;
> > +	struct ntb_rx_info __iomem *rx_info;
> >  	struct ntb_rx_info *remote_rx_info;
> >  
> >  	void (*tx_handler) (struct ntb_transport_qp *qp, void *qp_data,
> >  			    void *data, int len);
> >  	struct list_head tx_free_q;
> >  	spinlock_t ntb_tx_free_q_lock;
> > -	void *tx_mw;
> > +	void __iomem *tx_mw;
> >  	unsigned int tx_index;
> >  	unsigned int tx_max_entry;
> >  	unsigned int tx_max_frame;
> > @@ -166,7 +166,7 @@ enum {
> >  };
> >  
> >  struct ntb_payload_header {
> > -	u64 ver;
> > +	unsigned int ver;
> 
> why does sparse care about this?

I am using the number of tx/rx packets transmitted as a sanity check
on the data.  This is a 64bit counter.  There is no iowrite64, so I
truncated this to 32bits.  I can rework this part of the patch to do 2
iowrite32's and keep the value as 64bit.

Thanks,
Jon

> 
> thanks,
> 
> greg k-h

  reply	other threads:[~2013-01-21 21:13 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-19  9:02 [PATCH 0/21] NTB and ntb_netdev patches Jon Mason
2013-01-19  9:02 ` [PATCH 01/21] NTB: correct missing readq/writeq errors Jon Mason
2013-01-20 23:40   ` Greg KH
2013-01-21 17:38     ` Jon Mason
2013-01-21 18:23       ` Greg KH
2013-01-21 20:34         ` Ben Hutchings
2013-01-21 20:47           ` Greg KH
2013-01-19  9:02 ` [PATCH 02/21] NTB: Handle ntb client device probes without present hardware Jon Mason
2013-01-19  9:02 ` [PATCH 03/21] NTB: correct memory barrier Jon Mason
2013-01-19  9:02 ` [PATCH 04/21] NTB: separate transmit and receive windows Jon Mason
2013-01-19  9:02 ` [PATCH 05/21] NTB: No sleeping in interrupt context Jon Mason
2013-01-19  9:02 ` [PATCH 06/21] NTB: use simple_open for debugfs Jon Mason
2013-01-19  9:02 ` [PATCH 07/21] NTB: zero PCI driver data Jon Mason
2013-01-20 23:41   ` Greg KH
2013-01-19  9:02 ` [PATCH 08/21] NTB: declare unused variables Jon Mason
2013-01-20 23:42   ` Greg KH
2013-01-21 17:50     ` Jon Mason
2013-01-21 18:25       ` Greg KH
2013-01-19  9:02 ` [PATCH 09/21] NTB: namespacecheck cleanups Jon Mason
2013-01-19  9:02 ` [PATCH 10/21] NTB: whitespace cleanups Jon Mason
2013-01-19  9:02 ` [PATCH 11/21] NTB: correct stack usage warning in debugfs_read Jon Mason
2013-01-19  9:02 ` [PATCH 12/21] NTB: Remove reads across NTB Jon Mason
2013-01-19  9:02 ` [PATCH 13/21] NTB: Out of free receive entries issue Jon Mason
2013-01-19  9:02 ` [PATCH 14/21] NTB: Fix Sparse Warnings Jon Mason
2013-01-20 23:45   ` Greg KH
2013-01-21 21:13     ` Jon Mason [this message]
2013-01-21 21:37       ` Greg KH
2013-01-21 22:28         ` Jon Mason
2013-01-19  9:02 ` [PATCH 15/21] NTB: Update Version Jon Mason
2013-01-20 23:47   ` Greg KH
2013-01-21 17:57     ` Jon Mason
2013-01-21 18:26       ` Greg KH
2013-01-19  9:02 ` [PATCH 16/21] ntb_netdev: remove init/exit from probe/remove Jon Mason
2013-01-19  9:02 ` [PATCH 17/21] ntb_netdev: correct skb leak Jon Mason
2013-01-19  9:02 ` [PATCH 18/21] ntb_netdev: remove tx timeout Jon Mason
2013-01-19  9:02 ` [PATCH 19/21] ntb_netdev: declare unused variables and fix missing initializer Jon Mason
2013-01-20 23:47   ` Greg KH
2013-01-19  9:02 ` [PATCH 20/21] ntb_netdev: improve logging Jon Mason
2013-01-19 18:51   ` Joe Perches
2013-01-19  9:02 ` [PATCH 21/21] ntb_netdev: Update Version Jon Mason
2013-01-20 23:48 ` [PATCH 0/21] NTB and ntb_netdev patches Greg KH

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=20130121211350.GH22208@jonmason-lab \
    --to=jon.mason@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nab@linux-iscsi.org \
    --cc=netdev@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).