From patchwork Tue Aug 11 07:27:51 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: 6989441 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9E4D8C05AC for ; Tue, 11 Aug 2015 07:37:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B4C8C203A4 for ; Tue, 11 Aug 2015 07:37:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A60C120390 for ; Tue, 11 Aug 2015 07:37:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933725AbbHKHh5 (ORCPT ); Tue, 11 Aug 2015 03:37:57 -0400 Received: from mx-out-1.rwth-aachen.de ([134.130.5.186]:50247 "EHLO mx-out-1.rwth-aachen.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933629AbbHKHh5 (ORCPT ); Tue, 11 Aug 2015 03:37:57 -0400 X-IronPort-AV: E=Sophos;i="5.15,651,1432591200"; d="scan'208";a="471261045" Received: from hub2.rwth-ad.de (HELO mail.rwth-aachen.de) ([134.130.26.143]) by mx-1.rz.rwth-aachen.de with ESMTP; 11 Aug 2015 09:28:02 +0200 Received: from pebbles.fritz.box (77.181.178.202) by mail.rwth-aachen.de (134.130.26.143) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 11 Aug 2015 09:27:58 +0200 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= To: CC: =?UTF-8?q?Stefan=20Br=C3=BCns?= Subject: [PATCH 2/2] staging/fbtft: use spi_setup instead of direct call to master->setup Date: Tue, 11 Aug 2015 09:27:51 +0200 X-Mailer: git-send-email 2.1.4 In-Reply-To: <1439278071-21110-1-git-send-email-stefan.bruens@rwth-aachen.de> References: <1439278071-21110-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.17 Message-ID: <60ffd904-655b-404a-8c6c-5fb52f51566c@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=-7.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 */