From: Max Staudt <max@enpas.org>
To: b.zolnierkie@samsung.com, axboe@kernel.dk
Cc: linux-ide@vger.kernel.org, linux-m68k@vger.kernel.org,
linux-kernel@vger.kernel.org, glaubitz@physik.fu-berlin.de,
schmitzmic@gmail.com, geert@linux-m68k.org
Subject: Re: [PATCH v4] ata/pata_buddha: Probe via modalias instead of initcall
Date: Sun, 11 Aug 2019 21:28:33 +0200 [thread overview]
Message-ID: <d9fa8aca-62a4-5d4a-b63f-bdd628e6b304@enpas.org> (raw)
In-Reply-To: <20190811153643.12029-1-max@enpas.org>
Replying to my own patch with two more questions:
On 08/11/2019 05:36 PM, Max Staudt wrote:
> - /* allocate host */
> - host = ata_host_alloc(&z->dev, nr_ports);
Actually, this is an issue even the existing pata_buddha has: ata_host_alloc() will dev_set_drvdata(dev, host) which is fine on Buddha and Catweasel, but conflicts with zorro8390's own dev_set_drvdata() on an X-Surf board. Thus, if both pata_buddha and zorro8390 are active, only one can be unloaded. The original ide/buddha driver does not have this problem as far as I can see.
This should be resolved once we get around to MFD support, as Geert suggested.
Shall we leave this as-is, as it's not really a change from the status quo in pata_buddha?
> +static int __init pata_buddha_late_init(void)
> +{
> + struct zorro_dev *z = NULL;
> +
> + pr_info("pata_buddha: Scanning for stand-alone IDE controllers...\n");
> + zorro_register_driver(&pata_buddha_driver);
> +
> + pr_info("pata_buddha: Scanning for X-Surf boards...\n");
> + while ((z = zorro_find_device(ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF, z))) {
> + static struct zorro_device_id xsurf_ent =
> + { ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF, BOARD_XSURF};
> +
> + pata_buddha_probe(z, &xsurf_ent);
> + }
> +
> + return 0;
> +}
This is suboptimal, as we don't release memory in case pata_buddha_probe() fails. Any suggestions?
> +static void __exit pata_buddha_exit(void)
> +{
> + struct zorro_dev *z = NULL;
> +
> + pr_info("pata_buddha: Releasing X-Surf boards...\n");
> + while ((z = zorro_find_device(ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF, z))) {
> + struct ata_host *host = dev_get_drvdata(&z->dev);
> +
> + if (host)
> + ata_host_detach(host);
> + }
I guess that here we also need to manually release the resources we allocated with devm_* above. Any ideas?
Thanks
Max
next prev parent reply other threads:[~2019-08-11 19:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-11 15:36 [PATCH v4] ata/pata_buddha: Probe via modalias instead of initcall Max Staudt
2019-08-11 15:40 ` Max Staudt
2019-08-11 19:28 ` Max Staudt [this message]
2019-08-12 10:42 ` Bartlomiej Zolnierkiewicz
2019-08-12 10:55 ` Max Staudt
2019-08-12 12:15 ` Bartlomiej Zolnierkiewicz
2019-08-12 14:26 ` Max Staudt
2019-08-12 15:01 ` Bartlomiej Zolnierkiewicz
2019-08-12 15:39 ` Max Staudt
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=d9fa8aca-62a4-5d4a-b63f-bdd628e6b304@enpas.org \
--to=max@enpas.org \
--cc=axboe@kernel.dk \
--cc=b.zolnierkie@samsung.com \
--cc=geert@linux-m68k.org \
--cc=glaubitz@physik.fu-berlin.de \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@vger.kernel.org \
--cc=schmitzmic@gmail.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;
as well as URLs for NNTP newsgroup(s).