Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2103786pxk; Mon, 14 Sep 2020 05:04:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAzfJk0JBerfi0tfbZCthciAyCMxY3t+kEfimCjYCIYElyiscAQ/C9IUuHNSZzQMfCIoBu X-Received: by 2002:a50:cc9a:: with SMTP id q26mr17514175edi.64.1600085052792; Mon, 14 Sep 2020 05:04:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600085052; cv=none; d=google.com; s=arc-20160816; b=zFuy6GAC9rKdFUwDCFUifXivtSwp8TfIY76u3FMOoIvQtvMp/xUlOgwqBzfS/+SIfZ Z56CVFqh1I3dclpykrZQeLoJVEr2BhFD1IQn39+FwQeNmPMNmUNjyW50lOBqCq//Mq6s nwv5zBEt9lUYUNmaRk6C7/t513iXD+yaHzBWTJ+JCZB2ehEUegdoaC43AeuJzEu43j// BCHSp+3q8qbrEFHGp4kDCDNLP6fJPzedVAKiN72xxlWa8mu+dbGFLgWFtQnd2tNvOPan Rq+CZBPy5v9HJ+0Zhf6AwkseNOGWduX4z92Zh1OT8jsYHIaGLHv2I+5+DzHjNOPV4UkH YaiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=MAnMfyqXWfQGfIGw15jGsaHsgLXdnRjwDpDAGMwU7WA=; b=WL/h3ZnEm84FwnVrsntv0EIBr46oID0yRnLbMr1OlyoEQjErA/F96AlnTgobfWkKQP MaBJE+B9jUoBKv0KyJG9NCBNxw2aBlj5TYXLpXpF5dyggdT4gtyPsbbNH22Tl/N9NkkO vY2t0/Mxdumj30fqXYLhuRovirhV6ijY91JlmzQzYPx0u0RGoq2Dlvnj4p/9VTLcIyjV NeryLPns+HMv0zwrOo5eE4blU5mBzGwlhEjG8ne1mpHdOMpMruCjSiiyMJ4UgKzfPyyc Q35Mi953K/P/Wv9V0rSpk+vRwzv1EQ326w5D3tMVc5asszsIMdTHWG1HG13mf28dnYTb EVSw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x11si7736883edl.498.2020.09.14.05.03.49; Mon, 14 Sep 2020 05:04:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726120AbgINMB4 (ORCPT + 99 others); Mon, 14 Sep 2020 08:01:56 -0400 Received: from mail-oi1-f193.google.com ([209.85.167.193]:37398 "EHLO mail-oi1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726073AbgINLnJ (ORCPT ); Mon, 14 Sep 2020 07:43:09 -0400 Received: by mail-oi1-f193.google.com with SMTP id a3so17531511oib.4; Mon, 14 Sep 2020 04:43:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=MAnMfyqXWfQGfIGw15jGsaHsgLXdnRjwDpDAGMwU7WA=; b=l76HGE1NsOISgVHXfSQ9SiLtk2TOix9aj/YJ0J0SPZudXlpdkLP1v6DcZKG6Ddw8s8 NNsQ8AokJzRUmpVDqTFD/YUjdgK+hthpTDFcYzkVMMbx07EWRU184ZQ2IZ8EiUVTYLpQ eH2MzbpoDVMwRQ8asu6V+mdv4a+LNzOThzg/CSdK4611CwTviLkINyYaX7UIEmWMP2Gh ZPvt8yRyvhoVU6zpy+G6EIouGkaXDemsXuXzh3Q2MxMdVJ2SI/ZA+e4aIx1uBaubZwrs 2J/vGRWq7xpiREnUrJQEl5Su49RQXOB+8I/pVuXhlhLnrkVS8MW5uJubxmLoQOYapX7B l/1g== X-Gm-Message-State: AOAM531Gj3oci8H++Gc8J9k0AZCPxjNVU4Y4mpfnc9k3yiLnkiaEzS4H VNDn4pchByt03RdzG7pzf0Z6II4dpUV9/ESl69E= X-Received: by 2002:aca:3bc3:: with SMTP id i186mr7592032oia.148.1600083788561; Mon, 14 Sep 2020 04:43:08 -0700 (PDT) MIME-Version: 1.0 References: <3cf40b9df80a99a3eee6d3af79437016038f0a44.1600051331.git.fthain@telegraphics.com.au> In-Reply-To: <3cf40b9df80a99a3eee6d3af79437016038f0a44.1600051331.git.fthain@telegraphics.com.au> From: Geert Uytterhoeven Date: Mon, 14 Sep 2020 13:42:57 +0200 Message-ID: Subject: Re: [PATCH v2] ide/macide: Convert Mac IDE driver to platform driver To: Finn Thain Cc: "David S. Miller" , Bartlomiej Zolnierkiewicz , Joshua Thompson , linux-m68k , Linux Kernel Mailing List , linux-ide@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Finn, On Mon, Sep 14, 2020 at 4:47 AM Finn Thain wrote: > Add platform devices for the Mac IDE controller variants. Convert the > macide module into a platform driver to support two of those variants. > For the third, use a generic "pata_platform" driver instead. > This enables automatic loading of the appropriate module and begins > the process of replacing the driver with libata alternatives. > > Cc: Bartlomiej Zolnierkiewicz > Cc: Geert Uytterhoeven > Cc: Joshua Thompson > References: commit 5ed0794cde593 ("m68k/atari: Convert Falcon IDE drivers to platform drivers") > References: commit 7ad19a99ad431 ("ide: officially deprecated the legacy IDE driver") > Tested-by: Stan Johnson > Signed-off-by: Finn Thain > --- > This patch was tested successfully on a Powerbook 190 (MAC_IDE_BABOON) > using both pata_platform and ide_platform drivers. > The next step will be to try using these generic drivers with the other > IDE controller variants (MAC_IDE_QUADRA or MAC_IDE_PB) so that the macide > driver can be entirely replaced with libata drivers. > > Changed since v1: > - Adopted DEFINE_RES_MEM and DEFINE_RES_IRQ macros. > - Dropped IORESOURCE_IRQ_SHAREABLE flag as it is ignored by pata_platform.c > and IRQF_SHARED makes no difference in this case. > - Removed redundant release_mem_region() call. > - Enabled CONFIG_BLK_DEV_PLATFORM in mac_defconfig. We might also enable > CONFIG_PATA_PLATFORM but IMO migration to libata should be a separate > patch (as this patch has some unrelated benefits). Thanks for the update! BTW, who do you envision taking this (or the next version)? IDE or m68k? > --- a/arch/m68k/configs/mac_defconfig > +++ b/arch/m68k/configs/mac_defconfig > @@ -317,6 +317,7 @@ CONFIG_DUMMY_IRQ=m > CONFIG_IDE=y > CONFIG_IDE_GD_ATAPI=y > CONFIG_BLK_DEV_IDECD=y > +CONFIG_BLK_DEV_PLATFORM=y I guess we want this in multi_defconfig, too? > CONFIG_BLK_DEV_MAC_IDE=y > CONFIG_RAID_ATTRS=m > CONFIG_SCSI=y > --- a/drivers/ide/macide.c > +++ b/drivers/ide/macide.c > @@ -109,42 +110,61 @@ static const char *mac_ide_name[] = > * Probe for a Macintosh IDE interface > */ > > -static int __init macide_init(void) > +static int mac_ide_probe(struct platform_device *pdev) > { > printk(KERN_INFO "ide: Macintosh %s IDE controller\n", > mac_ide_name[macintosh_config->ide_type - 1]); > > - macide_setup_ports(&hw, base, irq); > + macide_setup_ports(&hw, mem->start, irq->start); > > - return ide_host_add(&d, hws, 1, NULL); > + rc = ide_host_add(&d, hws, 1, &host); > + if (rc) > + return rc; > + > + platform_set_drvdata(pdev, host); Move one up, to play it safe? > + return 0; > } > > -module_init(macide_init); > +static int mac_ide_remove(struct platform_device *pdev) > +{ > + struct ide_host *host = dev_get_drvdata(&pdev->dev); As you use platform_set_drvdata() above, you might as well use the platform_get_drvdata() helper here, for symmetry. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds