mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sandeep Jain <Sandeep_Jain@mentor.com>
To: <dwmw2@infradead.org>, <computersforpeace@gmail.com>
Cc: <linux-mtd@lists.infradead.org>, <linux-kernel@vger.kernel.org>,
	Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Subject: Re: [PATCH v1 1/2] mtd: m25p80: lock module while used
Date: Thu, 3 Nov 2016 17:09:27 +0530	[thread overview]
Message-ID: <20161103113926.GB4873@mentor.com> (raw)
In-Reply-To: <1470320194-9602-2-git-send-email-Sandeep_Jain@mentor.com>

Dear Maintainers,
	Requesting for your attention for patch review/merge.

Thanks & Regards,
Sandeep Jain

On Thu, Aug 04, 2016 at 07:46:33PM +0530, Sandeep Jain wrote:
> From: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
> 
> The change controls module users counter, which prevents to get
> accidental oops on module unload while it is in use by mtd subsystem:
> 
> % dd if=/dev/mtd0 of=/dev/null &
> % rmmod m25p80
> 
> Removing MTD device #0 (spi32766.0) with use count 1
> Unable to handle kernel paging request at virtual address 7f4fb7f8
> pgd = bd094000
> [7f4fb7f8] *pgd=4cb66811, *pte=00000000, *ppte=00000000
> Internal error: Oops: 80000007 [#1] PREEMPT SMP ARM
> 
> Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
> Signed-off-by: Sandeep Jain <Sandeep_Jain@mentor.com>
> ---
>  drivers/mtd/devices/m25p80.c |   15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
> index 9cf7fcd..2eb1530 100644
> --- a/drivers/mtd/devices/m25p80.c
> +++ b/drivers/mtd/devices/m25p80.c
> @@ -185,6 +185,19 @@ static ssize_t m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
>  	return ret;
>  }
>  
> +static void m25p80_put(struct mtd_info *mtd)
> +{
> +	module_put(THIS_MODULE);
> +}
> +
> +static int m25p80_get(struct mtd_info *mtd)
> +{
> +	if (!try_module_get(THIS_MODULE))
> +		return -ENODEV;
> +
> +	return 0;
> +}
> +
>  /*
>   * board specific setup should have ensured the SPI clock used here
>   * matches what the READ command supports, at least until this driver
> @@ -212,6 +225,8 @@ static int m25p_probe(struct spi_device *spi)
>  	nor->write = m25p80_write;
>  	nor->write_reg = m25p80_write_reg;
>  	nor->read_reg = m25p80_read_reg;
> +	nor->mtd._put_device = m25p80_put;
> +	nor->mtd._get_device = m25p80_get;
>  
>  	nor->dev = &spi->dev;
>  	spi_nor_set_flash_node(nor, spi->dev.of_node);
> -- 
> 1.7.9.5
> 

  reply	other threads:[~2016-11-03 11:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Sandeep Jain <Sandeep_Jain@mentor.com>
2016-08-04 14:01 ` [PATCH] mtd: Allocate bdi objects dynamically Sandeep Jain
2016-09-17 14:41   ` Richard Weinberger
2016-11-03 11:34     ` Sandeep Jain
2016-11-05  7:22       ` Marek Vasut
2016-11-29  8:12         ` Sandeep Jain
2016-12-01 15:39           ` Marek Vasut
2016-12-01 18:14             ` Brian Norris
2016-12-01 18:18               ` Marek Vasut
2016-08-04 14:16 ` [PATCH v1 0/2] mtd: lock module while used Sandeep Jain
2016-08-04 14:16   ` [PATCH v1 1/2] mtd: m25p80: " Sandeep Jain
2016-11-03 11:39     ` Sandeep Jain [this message]
2016-11-05  7:24       ` Marek Vasut
2016-12-01 19:10         ` Brian Norris
2016-08-04 14:16   ` [PATCH v1 2/2] mtd: Add hooks to call get and put on mtd devices Sandeep Jain
2016-08-04 17:32     ` Richard Weinberger
2016-08-05 11:54       ` Baxter, Jim
2016-08-05 12:13         ` Richard Weinberger

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=20161103113926.GB4873@mentor.com \
    --to=sandeep_jain@mentor.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=vladimir_zapolskiy@mentor.com \
    /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

Powered by JetHome