linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xu Jiucheng <B37781-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
To: <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>,
	<spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Cc: Xu Jiucheng <B37781-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
Subject: [PATCH] spi/mpc8xxx:Fix the wrong pointer of getting the platform data
Date: Tue, 26 Jun 2012 10:32:16 +0800	[thread overview]
Message-ID: <1340677936-6967-1-git-send-email-B37781@freescale.com> (raw)

In the spi_alloc_device(), the parent pointer of spi deivce has
been changed from master->dev.parent to &master->dev for device
unregistration, so the pointer of getting the platform data as
this 'spi->dev.parent->platform_data' is wrong.

Signed-off-by: Xu Jiucheng <B37781-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
---
 drivers/spi/spi_fsl_spi.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi_fsl_spi.c b/drivers/spi/spi_fsl_spi.c
index 7963c9b..7d164d3 100644
--- a/drivers/spi/spi_fsl_spi.c
+++ b/drivers/spi/spi_fsl_spi.c
@@ -139,7 +139,7 @@ static void fsl_spi_change_mode(struct spi_device *spi)
 static void fsl_spi_chipselect(struct spi_device *spi, int value)
 {
 	struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master);
-	struct fsl_spi_platform_data *pdata = spi->dev.parent->platform_data;
+	struct fsl_spi_platform_data *pdata = mpc8xxx_spi->dev->platform_data;
 	bool pol = spi->mode & SPI_CS_HIGH;
 	struct spi_mpc8xxx_cs	*cs = spi->controller_state;
 
@@ -934,7 +934,8 @@ err:
 
 static void fsl_spi_cs_control(struct spi_device *spi, bool on)
 {
-	struct device *dev = spi->dev.parent;
+	struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master);
+	struct device *dev = mpc8xxx_spi->dev;
 	struct mpc8xxx_spi_probe_info *pinfo = to_of_pinfo(dev->platform_data);
 	u16 cs = spi->chip_select;
 	int gpio = pinfo->gpios[cs];
-- 
1.6.4



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

             reply	other threads:[~2012-06-26  2:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-26  2:32 Xu Jiucheng [this message]
     [not found] ` <1340677936-6967-1-git-send-email-B37781-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2012-07-18  3:21   ` [PATCH] spi/mpc8xxx:Fix the wrong pointer of getting the platform data Jiucheng Xu
2012-07-18  3:44   ` Jiucheng Xu
2012-07-12  3:18 Jiucheng Xu
2012-07-30  9:10 Jiucheng Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1340677936-6967-1-git-send-email-B37781@freescale.com \
    --to=b37781-kzfg59tc24xl57midrcfdg@public.gmane.org \
    --cc=grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
    --cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).