netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Dooks <ben@fluff.org>
To: dmitry pervushin <dpervushin@gmail.com>
Cc: netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH] dm9000: fix spinlock issue and introduce platform_init callback
Date: Tue, 20 Nov 2007 14:51:52 +0000	[thread overview]
Message-ID: <20071120145151.GC3244@fluff.org.uk> (raw)
In-Reply-To: <1195569822.17808.20.camel@diimka.pervushin.msk.ru>

On Tue, Nov 20, 2007 at 05:43:42PM +0300, dmitry pervushin wrote:
> Hey all,
> 
> The patch below is intended to fix two problems:
> - trying to acquire spinlock twice on timeout condition

I'll have a look into this, although I think we may be better of
not dropping the spinlock and simply moving it out of
dm9000_init_dm9000() and ensure all callers of this function
hold the lock already.

> - create callback than can be used by platform code to initialize the
> chip

Hi, what purpose is the callback for? and if it takes a platform
device why is the prototype for 'void *' ?

This should have also been two seperate patches as there are two
different issues.
 
> Signed-off-by: dmitry pervushin <dpervushin@gmail.com>
> Index: linux/drivers/net/dm9000.c
> ===================================================================
> --- linux.orig/drivers/net/dm9000.c
> +++ linux/drivers/net/dm9000.c
> @@ -335,8 +335,11 @@ static void dm9000_timeout(struct net_de
>  
>  	netif_stop_queue(dev);
>  	dm9000_reset(db);
> +	spin_unlock_irqrestore(&db->lock,flags);
> +
>  	dm9000_init_dm9000(dev);
>  	/* We can accept TX packets again */
> +	spin_lock_irqsave(&db->lock,flags);
>  	dev->trans_start = jiffies;
>  	netif_wake_queue(dev);
>  
> @@ -526,6 +529,8 @@ dm9000_probe(struct platform_device *pde
>  			db->dumpblk = pdata->dumpblk;
>  	}
>  
> + 	if (pdata && pdata->platform_init)
> + 			pdata->platform_init(pdev);
>  	dm9000_reset(db);
>  
>  	/* try two times, DM9000 sometimes gets the first read wrong */
> @@ -1155,10 +1160,13 @@ dm9000_drv_resume(struct platform_device
>  {
>  	struct net_device *ndev = platform_get_drvdata(dev);
>  	board_info_t *db = (board_info_t *) ndev->priv;
> + 	struct dm9000_plat_data *pdata = dev->dev.platform_data;
>  
>  	if (ndev) {
>  
>  		if (netif_running(ndev)) {
> + 			if (pdata && pdata->platform_init)
> +         	                pdata->platform_init(dev);
>  			dm9000_reset(db);
>  			dm9000_init_dm9000(ndev);
>  
> Index: linux/include/linux/dm9000.h
> ===================================================================
> --- linux.orig/include/linux/dm9000.h
> +++ linux/include/linux/dm9000.h
> @@ -30,6 +30,9 @@ struct dm9000_plat_data {
>  	void	(*inblk)(void __iomem *reg, void *data, int len);
>  	void	(*outblk)(void __iomem *reg, void *data, int len);
>  	void	(*dumpblk)(void __iomem *reg, int len);
> +
> +	/* platform init, if any */
> +	void 	(*platform_init)(void *);
>  };
>  
>  #endif /* __DM9000_PLATFORM_DATA */
> 
> 
> -
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Ben (ben@fluff.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

  reply	other threads:[~2007-11-20 14:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-20 14:43 [PATCH] dm9000: fix spinlock issue and introduce platform_init callback dmitry pervushin
2007-11-20 14:51 ` Ben Dooks [this message]
2007-11-20 14:59   ` dmitry pervushin
2007-11-20 15:07     ` Ben Dooks

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=20071120145151.GC3244@fluff.org.uk \
    --to=ben@fluff.org \
    --cc=dpervushin@gmail.com \
    --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).