From patchwork Sun Aug 23 14:06:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Stefan_Br=C3=BCns?= X-Patchwork-Id: 7058011 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5F8FF9F305 for ; Sun, 23 Aug 2015 14:06:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4F93F20623 for ; Sun, 23 Aug 2015 14:06:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4D07820634 for ; Sun, 23 Aug 2015 14:06:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752970AbbHWOGp (ORCPT ); Sun, 23 Aug 2015 10:06:45 -0400 Received: from mx-out-1.rwth-aachen.de ([134.130.5.186]:39523 "EHLO mx-out-1.rwth-aachen.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752927AbbHWOGo (ORCPT ); Sun, 23 Aug 2015 10:06:44 -0400 X-IronPort-AV: E=Sophos;i="5.15,732,1432591200"; d="scan'208";a="479861541" Received: from hub2.rwth-ad.de (HELO mail.rwth-aachen.de) ([134.130.26.143]) by mx-1.rz.rwth-aachen.de with ESMTP; 23 Aug 2015 16:06:42 +0200 Received: from pebbles.fritz.box (78.49.84.11) by mail.rwth-aachen.de (134.130.26.143) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 23 Aug 2015 16:06:38 +0200 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= To: CC: Mark Brown , =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= , =?UTF-8?q?Stefan=20Br=C3=BCns?= Subject: [PATCH 2/2 RESEND] staging/fbtft: use spi_setup instead of direct call to master->setup Date: Sun, 23 Aug 2015 16:06:31 +0200 X-Mailer: git-send-email 2.1.4 In-Reply-To: <1440338791-30841-1-git-send-email-stefan.bruens@rwth-aachen.de> References: <1440338791-30841-1-git-send-email-stefan.bruens@rwth-aachen.de> MIME-Version: 1.0 X-PMWin-Version: 3.1.3.0, Antivirus-Engine: 3.60.0, Antivirus-Data: 5.18 Message-ID: <4787d5ed-b810-4d3e-b1bc-3a6db745d444@HUB2.rwth-ad.de> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Avoid a crash, as master->setup may be NULL (e.g. xilinx controller). Even if master->setup is set, spi_setup does several compatibility/ sanity checks which should not be skipped (fixes problems with displays/controllers needing emulation for bits_per_word = 9). Signed-off-by: Stefan BrĂ¼ns --- drivers/staging/fbtft/fb_watterott.c | 4 ++-- drivers/staging/fbtft/fbtft-core.c | 4 ++-- drivers/staging/fbtft/flexfb.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/fbtft/fb_watterott.c b/drivers/staging/fbtft/fb_watterott.c index 88fb2c0..8eae6ef 100644 --- a/drivers/staging/fbtft/fb_watterott.c +++ b/drivers/staging/fbtft/fb_watterott.c @@ -169,7 +169,7 @@ static int init_display(struct fbtft_par *par) /* enable SPI interface by having CS and MOSI low during reset */ save_mode = par->spi->mode; par->spi->mode |= SPI_CS_HIGH; - ret = par->spi->master->setup(par->spi); /* set CS inactive low */ + ret = spi_setup(par->spi); /* set CS inactive low */ if (ret) { dev_err(par->info->device, "Could not set SPI_CS_HIGH\n"); return ret; @@ -180,7 +180,7 @@ static int init_display(struct fbtft_par *par) par->fbtftops.reset(par); mdelay(1000); par->spi->mode = save_mode; - ret = par->spi->master->setup(par->spi); + ret = spi_setup(par->spi); if (ret) { dev_err(par->info->device, "Could not restore SPI mode\n"); return ret; diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c index 9cc8141..ba08da3 100644 --- a/drivers/staging/fbtft/fbtft-core.c +++ b/drivers/staging/fbtft/fbtft-core.c @@ -1434,12 +1434,12 @@ int fbtft_probe_common(struct fbtft_display *display, /* 9-bit SPI setup */ if (par->spi && display->buswidth == 9) { par->spi->bits_per_word = 9; - ret = par->spi->master->setup(par->spi); + ret = spi_setup(par->spi); if (ret) { dev_warn(&par->spi->dev, "9-bit SPI not available, emulating using 8-bit.\n"); par->spi->bits_per_word = 8; - ret = par->spi->master->setup(par->spi); + ret = spi_setup(par->spi); if (ret) goto out_release; /* allocate buffer with room for dc bits */ diff --git a/drivers/staging/fbtft/flexfb.c b/drivers/staging/fbtft/flexfb.c index 2c4ce07..fecf486 100644 --- a/drivers/staging/fbtft/flexfb.c +++ b/drivers/staging/fbtft/flexfb.c @@ -440,12 +440,12 @@ static int flexfb_probe_common(struct spi_device *sdev, par->fbtftops.write_register = fbtft_write_reg8_bus9; par->fbtftops.write_vmem = fbtft_write_vmem16_bus9; sdev->bits_per_word = 9; - ret = sdev->master->setup(sdev); + ret = spi_setup(sdev); if (ret) { dev_warn(dev, "9-bit SPI not available, emulating using 8-bit.\n"); sdev->bits_per_word = 8; - ret = sdev->master->setup(sdev); + ret = spi_setup(sdev); if (ret) goto out_release; /* allocate buffer with room for dc bits */