From patchwork Fri Feb 14 04:49:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 3649881 X-Patchwork-Delegate: broonie@sirena.org.uk Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0F09ABF13A for ; Fri, 14 Feb 2014 04:49:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3A6DB20212 for ; Fri, 14 Feb 2014 04:49:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 59D7820213 for ; Fri, 14 Feb 2014 04:49:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751552AbaBNEtU (ORCPT ); Thu, 13 Feb 2014 23:49:20 -0500 Received: from mail-pd0-f182.google.com ([209.85.192.182]:52986 "EHLO mail-pd0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751512AbaBNEtT (ORCPT ); Thu, 13 Feb 2014 23:49:19 -0500 Received: by mail-pd0-f182.google.com with SMTP id v10so11459198pde.13 for ; Thu, 13 Feb 2014 20:49:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:cc:date:content-type :mime-version:content-transfer-encoding; bh=pTSq64PfVQBN9I8Q1Z7qen+7B25D/Fr2GDzZTx4gS3Y=; b=VBdfwLB/QSHNbM9uDfA4tLjWe9YJvEXrdBRyN0ebgpFDkPGFuPGu0O6Uf/rAPaudv0 EWWEnhSYwqefIpOZXmYwhWmPR3kZdn9GfyPbDgiJVGpFkUH7xrL1in69Doleb1X/81is c2F72urmQQHocdipVIo+D8b2IsGIJMmucKD0gr5CseHZsrszv9MvheSOJvdQYYrdBdR+ 5fk2Ow/AiDowWfcW8x5Pn1S8o+Nk/ozT0C0cwIp+4qd4xSyfaby7QvpHZkJbMgG3sEc1 RZiSz+bUIMJMwzdT5cyj9SvJ/wzd7rx07WHc+9ec7VI6mnHuMKstQfImmelAdbRCeuBW 7G4Q== X-Gm-Message-State: ALoCoQlW3kMYlENzXGWpk6azewVXejpYNm1xLUK3Cy8SQ/hxpO2M3afsM1Z6BhseyL0MMXEi7ABt X-Received: by 10.68.241.134 with SMTP id wi6mr6476679pbc.44.1392353358814; Thu, 13 Feb 2014 20:49:18 -0800 (PST) Received: from [192.168.0.102] (218-164-130-78.dynamic.hinet.net. [218.164.130.78]) by mx.google.com with ESMTPSA id tu3sm30953758pab.1.2014.02.13.20.49.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 13 Feb 2014 20:49:18 -0800 (PST) Message-ID: <1392353352.19487.1.camel@phoenix> Subject: [PATCH] spi: fsl-dspi: Fix getting correct address for master From: Axel Lin To: Mark Brown Cc: Chao Fu , Alison Wang , linux-spi@vger.kernel.org Date: Fri, 14 Feb 2014 12:49:12 +0800 X-Mailer: Evolution 3.6.4-0ubuntu1 Mime-Version: 1.0 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Current code set platform drvdata to dspi. However, the code in dspi_suspend() and dspi_resume() assumes the drvdata is the address of master. Fix it by setting platform drvdata to master. Signed-off-by: Axel Lin --- drivers/spi/spi-fsl-dspi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index ec79f72..a253920 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -420,7 +420,6 @@ static int dspi_suspend(struct device *dev) static int dspi_resume(struct device *dev) { - struct spi_master *master = dev_get_drvdata(dev); struct fsl_dspi *dspi = spi_master_get_devdata(master); @@ -504,7 +503,7 @@ static int dspi_probe(struct platform_device *pdev) clk_prepare_enable(dspi->clk); init_waitqueue_head(&dspi->waitq); - platform_set_drvdata(pdev, dspi); + platform_set_drvdata(pdev, master); ret = spi_bitbang_start(&dspi->bitbang); if (ret != 0) { @@ -525,7 +524,8 @@ out_master_put: static int dspi_remove(struct platform_device *pdev) { - struct fsl_dspi *dspi = platform_get_drvdata(pdev); + struct spi_master *master = platform_get_drvdata(pdev); + struct fsl_dspi *dspi = spi_master_get_devdata(master); /* Disconnect from the SPI framework */ spi_bitbang_stop(&dspi->bitbang);