Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1514471 > unrolled thread
| Started by | Sandeep Jain <Sandeep_Jain@mentor.com> |
|---|---|
| First post | 2016-11-03 12:50 +0100 |
| Last post | 2016-11-05 08:40 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH v1 1/2] mtd: m25p80: lock module while used Sandeep Jain <Sandeep_Jain@mentor.com> - 2016-11-03 12:50 +0100
Re: [PATCH v1 1/2] mtd: m25p80: lock module while used Marek Vasut <marek.vasut@gmail.com> - 2016-11-05 08:40 +0100
| From | Sandeep Jain <Sandeep_Jain@mentor.com> |
|---|---|
| Date | 2016-11-03 12:50 +0100 |
| Subject | Re: [PATCH v1 1/2] mtd: m25p80: lock module while used |
| Message-ID | <szoGS-3hQ-17@gated-at.bofh.it> |
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
>
[toc] | [next] | [standalone]
| From | Marek Vasut <marek.vasut@gmail.com> |
|---|---|
| Date | 2016-11-05 08:40 +0100 |
| Message-ID | <sA3K1-4Yr-7@gated-at.bofh.it> |
| In reply to | #1514471 |
On 11/03/2016 12:39 PM, Sandeep Jain wrote:
> 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);
This makes me ponder how many other drivers suffer from this issue and
whether you shouldn't fix this in the core code instead. What do you think?
--
Best regards,
Marek Vasut
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web