From patchwork Mon Feb 7 10:51:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 82098 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id A8144B7088 for ; Mon, 7 Feb 2011 21:58:38 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753821Ab1BGK56 (ORCPT ); Mon, 7 Feb 2011 05:57:58 -0500 Received: from mail-yx0-f174.google.com ([209.85.213.174]:47194 "EHLO mail-yx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753529Ab1BGK5j (ORCPT ); Mon, 7 Feb 2011 05:57:39 -0500 Received: by yxt3 with SMTP id 3so1638357yxt.19 for ; Mon, 07 Feb 2011 02:57:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:subject:date:user-agent:cc:mime-version :content-type:content-transfer-encoding:message-id; bh=iazQm7XbzywXC2HSjd0wiHt+71XjKWwtVJrB8A/8VO0=; b=NKey3NLw1JCwlYzlssP6ZSCMcfa5ntUxbua4ExG7vRQ5U3JZiApbelgi0G0T6vQ25E 9MkahGr+O4WQyLEjPXTxulZnlSzIt+QUf6FFzKzH1OdYRBwBhd8OAHyALb4oyWwovLzK 75ZbfBVqxnNqHHQsBNJvsaIMLbH1FcmVSPHnE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:user-agent:cc:mime-version:content-type :content-transfer-encoding:message-id; b=N9BJ3JrFcy8Wym+zCp8QlhEZy9Uginpu/TIMWB9R68FR/xsfzUGL0aToFbIpVGFLCI ENUme66GjH0N3Frdj/Q2Z+JN66hIEzELjXMBj5+y9iy68NkXayjYADKvIKj8trqJJRCo FHr/He2QTeK3BwDomE8BiunanzPp+lT3u8OAk= Received: by 10.100.96.5 with SMTP id t5mr9527492anb.258.1297076258743; Mon, 07 Feb 2011 02:57:38 -0800 (PST) Received: from linux-mhg7.site (89-74-121-163.dynamic.chello.pl [89.74.121.163]) by mx.google.com with ESMTPS id w4sm5472680anw.16.2011.02.07.02.57.37 (version=SSLv3 cipher=RC4-MD5); Mon, 07 Feb 2011 02:57:38 -0800 (PST) From: Bartlomiej Zolnierkiewicz To: linux-ide@vger.kernel.org Subject: [PATCH] ide-cs: housekeeping Date: Mon, 7 Feb 2011 11:51:07 +0100 User-Agent: KMail/1.13.5 (Linux/2.6.34.7-0.7-desktop; KDE/4.4.4; x86_64; ; ) Cc: linux-kernel@vger.kernel.org MIME-Version: 1.0 Message-Id: <201102071151.08396.bzolnier@gmail.com> Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org * remove needless includes * remove stale comments * remove struct ide_info_t * remove legacy dev_dbg() debugging * inline ide_{config,release}() Compile-tested only. Signed-off-by: Bartlomiej Zolnierkiewicz Acked-by: Dominik Brodowski [pcmcia parts] --- drivers/ide/ide-cs.c | 83 +++++++-------------------------------------------- 1 file changed, 12 insertions(+), 71 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: b/drivers/ide/ide-cs.c =================================================================== --- a/drivers/ide/ide-cs.c +++ b/drivers/ide/ide-cs.c @@ -32,13 +32,7 @@ #include #include #include -#include -#include -#include -#include -#include #include -#include #include #include #include @@ -50,58 +44,10 @@ #define DRV_NAME "ide-cs" -/*====================================================================*/ - -/* Module parameters */ - MODULE_AUTHOR("David Hinds "); MODULE_DESCRIPTION("PCMCIA ATA/IDE card driver"); MODULE_LICENSE("Dual MPL/GPL"); -/*====================================================================*/ - -typedef struct ide_info_t { - struct pcmcia_device *p_dev; - struct ide_host *host; - int ndev; -} ide_info_t; - -static void ide_release(struct pcmcia_device *); -static int ide_config(struct pcmcia_device *); - -static void ide_detach(struct pcmcia_device *p_dev); - -static int ide_probe(struct pcmcia_device *link) -{ - ide_info_t *info; - - dev_dbg(&link->dev, "ide_attach()\n"); - - /* Create new ide device */ - info = kzalloc(sizeof(*info), GFP_KERNEL); - if (!info) - return -ENOMEM; - - info->p_dev = link; - link->priv = info; - - link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO | - CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC; - - return ide_config(link); -} /* ide_attach */ - -static void ide_detach(struct pcmcia_device *link) -{ - ide_info_t *info = link->priv; - - dev_dbg(&link->dev, "ide_detach(0x%p)\n", link); - - ide_release(link); - - kfree(info); -} /* ide_detach */ - static const struct ide_port_ops idecs_port_ops = { .quirkproc = ide_undecoded_slave, }; @@ -186,14 +132,14 @@ static int pcmcia_check_one_config(struc return pcmcia_request_io(pdev); } -static int ide_config(struct pcmcia_device *link) +static int ide_probe(struct pcmcia_device *link) { - ide_info_t *info = link->priv; int ret = 0, is_kme = 0; unsigned long io_base, ctl_base; struct ide_host *host; - dev_dbg(&link->dev, "ide_config(0x%p)\n", link); + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO | + CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC; is_kme = ((link->manf_id == MANFID_KME) && ((link->card_id == PRODID_KME_KXLC005_A) || @@ -234,8 +180,7 @@ static int ide_config(struct pcmcia_devi if (host == NULL) goto failed; - info->ndev = 1; - info->host = host; + link->priv = host; dev_info(&link->dev, "ide-cs: hd%c: Vpp = %d.%d\n", 'a' + host->ports[0]->index * 2, link->vpp / 10, link->vpp % 10); @@ -243,18 +188,15 @@ static int ide_config(struct pcmcia_devi return 0; failed: - ide_release(link); + pcmcia_disable_device(link); return -ENODEV; -} /* ide_config */ +} -static void ide_release(struct pcmcia_device *link) +static void ide_detach(struct pcmcia_device *link) { - ide_info_t *info = link->priv; - struct ide_host *host = info->host; + struct ide_host *host = link->priv; - dev_dbg(&link->dev, "ide_release(0x%p)\n", link); - - if (info->ndev) { + if (host) { ide_hwif_t *hwif = host->ports[0]; unsigned long data_addr, ctl_addr; @@ -262,15 +204,14 @@ static void ide_release(struct pcmcia_de ctl_addr = hwif->io_ports.ctl_addr; ide_host_remove(host); - info->ndev = 0; + link->priv = NULL; release_region(ctl_addr, 1); release_region(data_addr, 8); } pcmcia_disable_device(link); -} /* ide_release */ - +} static struct pcmcia_device_id ide_ids[] = { PCMCIA_DEVICE_FUNC_ID(4), @@ -344,7 +285,7 @@ MODULE_DEVICE_TABLE(pcmcia, ide_ids); static struct pcmcia_driver ide_cs_driver = { .owner = THIS_MODULE, - .name = "ide-cs", + .name = DRV_NAME, .probe = ide_probe, .remove = ide_detach, .id_table = ide_ids,