linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Schmitz <schmitzmic@gmail.com>
To: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
	linux-block@vger.kernel.org, linux-m68k@lists.linux-m68k.org,
	Christoph Hellwig <hch@lst.de>,
	Luis Chamberlain <mcgrof@kernel.org>,
	Finn Thain <fthain@linux-m68k.org>
Subject: Re: [PATCH v2] ataflop: remove ataflop_probe_lock mutex
Date: Mon, 18 Oct 2021 12:47:02 +1300	[thread overview]
Message-ID: <156eaf61-a225-d560-ebfe-617756ad2c5e@gmail.com> (raw)
In-Reply-To: <7bf8ba1a-ed7c-059b-f4a1-cd7cfb5c21da@gmail.com>

Hi Tetsuo,

nevermind - stock 5.9 doesn't work either (mount hangs indefinitely).

Might have to do with format autoprobing - I'll try that next.

Cheers,

	Michael


On 18/10/21 08:05, Michael Schmitz wrote:
>> Michael Schmitz wrote:
>>> Not as a module, no. I use the Atari floppy driver built-in. Latest
>>> kernel version I ran was 5.13.
>>
>> Great. Can you try this patch alone?
>
> Doesn't appear to work, sorry.
>
> Regards,
>
>     Michael Schmitz
>
>>
>>  drivers/block/ataflop.c | 55 ++++++++++++++++++++---------------------
>>  1 file changed, 27 insertions(+), 28 deletions(-)
>>
>> diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c
>> index a093644ac39f..adfe198e4699 100644
>> --- a/drivers/block/ataflop.c
>> +++ b/drivers/block/ataflop.c
>> @@ -1986,8 +1986,6 @@ static int ataflop_alloc_disk(unsigned int
>> drive, unsigned int type)
>>      return 0;
>>  }
>>
>> -static DEFINE_MUTEX(ataflop_probe_lock);
>> -
>>  static void ataflop_probe(dev_t dev)
>>  {
>>      int drive = MINOR(dev) & 3;
>> @@ -1998,12 +1996,30 @@ static void ataflop_probe(dev_t dev)
>>
>>      if (drive >= FD_MAX_UNITS || type >= NUM_DISK_MINORS)
>>          return;
>> -    mutex_lock(&ataflop_probe_lock);
>>      if (!unit[drive].disk[type]) {
>>          if (ataflop_alloc_disk(drive, type) == 0)
>>              add_disk(unit[drive].disk[type]);
>>      }
>> -    mutex_unlock(&ataflop_probe_lock);
>> +}
>> +
>> +static void atari_floppy_cleanup(void)
>> +{
>> +    int i;
>> +    int type;
>> +
>> +    for (i = 0; i < FD_MAX_UNITS; i++) {
>> +        for (type = 0; type < NUM_DISK_MINORS; type++) {
>> +            if (!unit[i].disk[type])
>> +                continue;
>> +            del_gendisk(unit[i].disk[type]);
>> +            blk_cleanup_queue(unit[i].disk[type]->queue);
>> +            put_disk(unit[i].disk[type]);
>> +        }
>> +        blk_mq_free_tag_set(&unit[i].tag_set);
>> +    }
>> +
>> +    del_timer_sync(&fd_timer);
>> +    atari_stram_free(DMABuffer);
>>  }
>>
>>  static int __init atari_floppy_init (void)
>> @@ -2015,11 +2031,6 @@ static int __init atari_floppy_init (void)
>>          /* Amiga, Mac, ... don't have Atari-compatible floppy :-) */
>>          return -ENODEV;
>>
>> -    mutex_lock(&ataflop_probe_lock);
>> -    ret = __register_blkdev(FLOPPY_MAJOR, "fd", ataflop_probe);
>> -    if (ret)
>> -        goto out_unlock;
>> -
>>      for (i = 0; i < FD_MAX_UNITS; i++) {
>>          memset(&unit[i].tag_set, 0, sizeof(unit[i].tag_set));
>>          unit[i].tag_set.ops = &ataflop_mq_ops;
>> @@ -2072,7 +2083,12 @@ static int __init atari_floppy_init (void)
>>             UseTrackbuffer ? "" : "no ");
>>      config_types();
>>
>> -    return 0;
>> +    ret = __register_blkdev(FLOPPY_MAJOR, "fd", ataflop_probe);
>> +    if (ret) {
>> +        printk(KERN_ERR "atari_floppy_init: cannot register block
>> device\n");
>> +        atari_floppy_cleanup();
>> +    }
>> +    return ret;
>>
>>  err:
>>      while (--i >= 0) {
>> @@ -2081,9 +2097,6 @@ static int __init atari_floppy_init (void)
>>          blk_mq_free_tag_set(&unit[i].tag_set);
>>      }
>>
>> -    unregister_blkdev(FLOPPY_MAJOR, "fd");
>> -out_unlock:
>> -    mutex_unlock(&ataflop_probe_lock);
>>      return ret;
>>  }
>>
>> @@ -2128,22 +2141,8 @@ __setup("floppy=", atari_floppy_setup);
>>
>>  static void __exit atari_floppy_exit(void)
>>  {
>> -    int i, type;
>> -
>> -    for (i = 0; i < FD_MAX_UNITS; i++) {
>> -        for (type = 0; type < NUM_DISK_MINORS; type++) {
>> -            if (!unit[i].disk[type])
>> -                continue;
>> -            del_gendisk(unit[i].disk[type]);
>> -            blk_cleanup_queue(unit[i].disk[type]->queue);
>> -            put_disk(unit[i].disk[type]);
>> -        }
>> -        blk_mq_free_tag_set(&unit[i].tag_set);
>> -    }
>>      unregister_blkdev(FLOPPY_MAJOR, "fd");
>> -
>> -    del_timer_sync(&fd_timer);
>> -    atari_stram_free( DMABuffer );
>> +    atari_floppy_cleanup();
>>  }
>>
>>  module_init(atari_floppy_init)
>>

  reply	other threads:[~2021-10-17 23:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-16 13:25 [PATCH] ataflop: unlock ataflop_probe_lock at atari_floppy_init() Tetsuo Handa
2021-10-16 22:56 ` Finn Thain
2021-10-17  1:52 ` Michael Schmitz
2021-10-17  2:09   ` [PATCH v2] ataflop: remove ataflop_probe_lock mutex Tetsuo Handa
2021-10-17 19:05     ` Michael Schmitz
2021-10-17 23:47       ` Michael Schmitz [this message]
2021-10-18  8:15         ` Michael Schmitz
2021-10-18 22:25     ` Michael Schmitz
2021-10-21 16:20     ` Luis Chamberlain
2021-10-21 16:21       ` Luis Chamberlain

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=156eaf61-a225-d560-ebfe-617756ad2c5e@gmail.com \
    --to=schmitzmic@gmail.com \
    --cc=fthain@linux-m68k.org \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    --cc=mcgrof@kernel.org \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    /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).