From patchwork Fri Nov 2 19:09:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 196746 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 73F1E2C00C4 for ; Sat, 3 Nov 2012 06:10:06 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935411Ab2KBTKF (ORCPT ); Fri, 2 Nov 2012 15:10:05 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:55633 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935357Ab2KBTKE (ORCPT ); Fri, 2 Nov 2012 15:10:04 -0400 Received: by mail-pa0-f46.google.com with SMTP id hz1so2649106pad.19 for ; Fri, 02 Nov 2012 12:10:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=MjfYK4zZGE2Uzoq8ADOwsLQm/0Q8w2kD9d6Be+lYIBw=; b=dMv9ysjlROHqhqcbEf5fWUgdDHtFvI8dbz5D1AW02OwZmbPwUhd5w5Bsv8xkLC1Bh+ xcbPUEVw9AUbtSpa9l4fetsJWamNn3EUiDrWEwjdiHYOdeQsizkSXdm42BK1sz996Y0q pxUOeEDFwCZr2W86givOPvD28XYHFv5Wttako0BRaZ91Tj46WxP12NzaQJfK6Vz5mpgd sVAeJlW2W+7XehOka7LtZ/OGfU+TeGsDTR3Ht1tRQFPSqORpwBt1y4AZBYxC2X8RU1/3 GdwXa2Ia4pL1kIDyZkG/72mWujiMmRSbsCD1VIsaLvK1fxZBOuEvGhdx6cDY6EGafe0K 2Wwg== Received: by 10.68.218.97 with SMTP id pf1mr8890356pbc.96.1351883403738; Fri, 02 Nov 2012 12:10:03 -0700 (PDT) Received: from ld-irv-0074.broadcom.com (pv141010.reshsg.uci.edu. [169.234.141.10]) by mx.google.com with ESMTPS id ay5sm6142711pab.1.2012.11.02.12.10.02 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 02 Nov 2012 12:10:02 -0700 (PDT) From: Brian Norris To: Jeff Garzik Cc: , Tejun Heo , Brian Norris , Sergei Shtylyov Subject: [PATCH v2 04/14] libata: implement ata_platform_remove_one() Date: Fri, 2 Nov 2012 12:09:53 -0700 Message-Id: <1351883393-32354-1-git-send-email-computersforpeace@gmail.com> X-Mailer: git-send-email 1.7.11.3 In-Reply-To: <1351842388-27210-5-git-send-email-computersforpeace@gmail.com> References: <1351842388-27210-5-git-send-email-computersforpeace@gmail.com> Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org This relatively simple boiler-plate code is repeated in several platform drivers. We should implement a common version in libata. Signed-off-by: Brian Norris --- v2: fix whitespace drivers/ata/libata-core.c | 23 +++++++++++++++++++++++ include/linux/libata.h | 4 ++++ 2 files changed, 27 insertions(+) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 611050d..7bf1199 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -67,6 +67,7 @@ #include #include #include +#include #include "libata.h" #include "libata-transport.h" @@ -6350,6 +6351,26 @@ int ata_pci_device_resume(struct pci_dev *pdev) #endif /* CONFIG_PCI */ +/** + * ata_platform_remove_one- Platform layer callback for device removal + * @pdev: Platform device that was removed + * + * Platform layer indicates to libata via this hook that hot-unplug or + * module unload event has occurred. Detach all ports. Resource + * release is handled via devres. + * + * LOCKING: + * Inherited from platform layer (may sleep). + */ +int ata_platform_remove_one(struct platform_device *pdev) +{ + struct ata_host *host = platform_get_drvdata(pdev); + + ata_host_detach(host); + + return 0; +} + static int __init ata_parse_force_one(char **cur, struct ata_force_ent *force_ent, const char **reason) @@ -6844,6 +6865,8 @@ EXPORT_SYMBOL_GPL(ata_pci_device_resume); #endif /* CONFIG_PM */ #endif /* CONFIG_PCI */ +EXPORT_SYMBOL_GPL(ata_platform_remove_one); + EXPORT_SYMBOL_GPL(__ata_ehi_push_desc); EXPORT_SYMBOL_GPL(ata_ehi_push_desc); EXPORT_SYMBOL_GPL(ata_ehi_clear_desc); diff --git a/include/linux/libata.h b/include/linux/libata.h index 464e67c..cedcd0f 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -1103,6 +1103,10 @@ extern int ata_pci_device_resume(struct pci_dev *pdev); #endif /* CONFIG_PM */ #endif /* CONFIG_PCI */ +struct platform_device; + +extern int ata_platform_remove_one(struct platform_device *pdev); + /* * ACPI - drivers/ata/libata-acpi.c */