Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756843AbbBEIiE (ORCPT ); Thu, 5 Feb 2015 03:38:04 -0500 Received: from mail-bn1bon0057.outbound.protection.outlook.com ([157.56.111.57]:5664 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755018AbbBEIh7 (ORCPT ); Thu, 5 Feb 2015 03:37:59 -0500 From: Aaron Wu To: , , , , CC: Aaron Wu Subject: [PATCH V4 2/2] bfin_can: rewrite the driver into common style with MMU Date: Thu, 5 Feb 2015 16:28:50 +0800 Message-ID: <1423124930-12871-2-git-send-email-Aaron.wu@analog.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1423124930-12871-1-git-send-email-Aaron.wu@analog.com> References: <1423124930-12871-1-git-send-email-Aaron.wu@analog.com> MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 0 Authentication-Results: spf=pass (sender IP is 137.71.25.55) smtp.mailfrom=Aaron.Wu@analog.com; vger.kernel.org; dkim=none (message not signed) header.d=none; X-Forefront-Antispam-Report: CIP:137.71.25.55;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(438002)(47776003)(36756003)(77096005)(87936001)(76176999)(50986999)(2950100001)(50226001)(77156002)(48376002)(50466002)(46102003)(62966003)(86362001)(6806004)(229853001)(92566002)(2201001)(19580405001)(19580395003)(2101003);DIR:OUT;SFP:1101;SCL:1;SRVR:BY2PR03MB380;H:nwd2mta1.analog.com;FPR:;SPF:Pass;MLV:sfv;LANG:en; X-Microsoft-Antispam: UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:BY2PR03MB380; X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004);SRVR:BY2PR03MB380; X-Forefront-PRVS: 0478C23FE0 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:;SRVR:BY2PR03MB380; X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Feb 2015 08:37:54.7010 (UTC) X-MS-Exchange-CrossTenant-Id: eaa689b4-8f87-40e0-9c6f-7228de4d754a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=eaa689b4-8f87-40e0-9c6f-7228de4d754a;Ip=[137.71.25.55] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR03MB380 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2330 Lines: 81 Rewrite the blackfin CAN driver into common style V4 changes: remove unused variable in patch 2/2 V3 changes: remove redundant cast in patch 2/2 V2 changes: split patch into two parts V1 changes: rewrite code into common style Signed-off-by: Aaron Wu --- drivers/net/can/bfin_can.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/drivers/net/can/bfin_can.c b/drivers/net/can/bfin_can.c index 0a5eff4..0209c14 100644 --- a/drivers/net/can/bfin_can.c +++ b/drivers/net/can/bfin_can.c @@ -551,16 +551,10 @@ static int bfin_can_probe(struct platform_device *pdev) goto exit; } - if (!request_mem_region(res_mem->start, resource_size(res_mem), - dev_name(&pdev->dev))) { - err = -EBUSY; - goto exit; - } - /* request peripheral pins */ err = peripheral_request_list(pdata, dev_name(&pdev->dev)); if (err) - goto exit_mem_release; + goto exit; dev = alloc_bfin_candev(); if (!dev) { @@ -569,7 +563,13 @@ static int bfin_can_probe(struct platform_device *pdev) } priv = netdev_priv(dev); - priv->membase = (void __iomem *)res_mem->start; + + priv->membase = devm_ioremap_resource(&pdev->dev, res_mem); + if (IS_ERR(priv->membase)) { + dev_err(&pdev->dev, "Cannot map IO\n"); + return PTR_ERR(priv->membase); + } + priv->rx_irq = rx_irq->start; priv->tx_irq = tx_irq->start; priv->err_irq = err_irq->start; @@ -601,8 +601,6 @@ exit_candev_free: free_candev(dev); exit_peri_pin_free: peripheral_free_list(pdata); -exit_mem_release: - release_mem_region(res_mem->start, resource_size(res_mem)); exit: return err; } @@ -611,15 +609,11 @@ static int bfin_can_remove(struct platform_device *pdev) { struct net_device *dev = platform_get_drvdata(pdev); struct bfin_can_priv *priv = netdev_priv(dev); - struct resource *res; bfin_can_set_reset_mode(dev); unregister_candev(dev); - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - release_mem_region(res->start, resource_size(res)); - peripheral_free_list(priv->pin_list); free_candev(dev); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/