From patchwork Fri Feb 21 01:12:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 3693001 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 7ADA4BF13A for ; Fri, 21 Feb 2014 01:12:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9DE2920120 for ; Fri, 21 Feb 2014 01:12:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B540320117 for ; Fri, 21 Feb 2014 01:12:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932609AbaBUBMW (ORCPT ); Thu, 20 Feb 2014 20:12:22 -0500 Received: from mail-pd0-f176.google.com ([209.85.192.176]:59686 "EHLO mail-pd0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932608AbaBUBMT (ORCPT ); Thu, 20 Feb 2014 20:12:19 -0500 Received: by mail-pd0-f176.google.com with SMTP id w10so2555839pde.7 for ; Thu, 20 Feb 2014 17:12: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:in-reply-to :references:content-type:mime-version:content-transfer-encoding; bh=o5DGZ95c2QmCGuqNkRV9SaD5CBMkdnw/WBmLAM8VWjk=; b=G+3HveIhN66wFbiySgy2O16XmGMXS0OXElWoxn0ObHZDD/v0ylc1WsGL1tK19LXkxM HkOkdrZ5Rdq5vY1Ds+Hp2GvI2iSX/SvYZw1dD2Y/ov3qnMVDPA2ffNXsDSMTObNwLqwG C6xy3wVUTAOjgatAKpcDBtJ5FY1GLl5heS6wB+PKkSqikxbyS0DStbJa5OTS9P8sfXGh JBTkza+qeqtawuVoR2yl8Jm28jXboihjQatMMYF/0WySvepKc2Ihp6X+NZ7hUJQ3qgVt dyOqoDKzC+qRdGN/QXWnrRV8fhWvHAQRO0gvbJV9ZnTCaC/U92pp9kTDVBmS/mSYcb53 5MEA== X-Gm-Message-State: ALoCoQnPl35R5LzLwxGBtph4PRfX1cpIB2E0iX5nnV/nSwcb798BfIR7Ouk4zsw75RtttZo5nMP1 X-Received: by 10.66.154.169 with SMTP id vp9mr5561484pab.39.1392945139087; Thu, 20 Feb 2014 17:12:19 -0800 (PST) Received: from [192.168.1.102] (111-240-52-24.dynamic.hinet.net. [111.240.52.24]) by mx.google.com with ESMTPSA id yo9sm36895458pab.16.2014.02.20.17.12.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Feb 2014 17:12:18 -0800 (PST) Message-ID: <1392945135.4125.3.camel@phoenix> Subject: [PATCH 2/2] spi: dup: Convert ot let spi core handle checking transfer speed From: Axel Lin To: Mark Brown Cc: "Ivan T. Ivanov" , linux-spi@vger.kernel.org Date: Fri, 21 Feb 2014 09:12:15 +0800 In-Reply-To: <1392945066.4125.2.camel@phoenix> References: <1392945066.4125.2.camel@phoenix> 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 Set master->max_speed_hz then spi core will handle checking transfer speed. So we can remove the same checking in this driver. Also remove checking spi->chip_select in spi_qup_setup(), the checking is done by spi core. Signed-off-by: Axel Lin Acked-by: Ivan T. Ivanov --- drivers/spi/spi-qup.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c index 5edc56f..dec339d 100644 --- a/drivers/spi/spi-qup.c +++ b/drivers/spi/spi-qup.c @@ -134,7 +134,6 @@ struct spi_qup { struct clk *cclk; /* core clock */ struct clk *iclk; /* interface clock */ int irq; - u32 max_speed_hz; spinlock_t lock; int in_fifo_sz; @@ -517,18 +516,6 @@ static int spi_qup_setup(struct spi_device *spi) struct spi_qup *controller = spi_master_get_devdata(spi->master); struct spi_qup_device *chip = spi_get_ctldata(spi); - if (spi->chip_select >= spi->master->num_chipselect) { - dev_err(controller->dev, "invalid chip_select %d\n", - spi->chip_select); - return -EINVAL; - } - - if (spi->max_speed_hz > controller->max_speed_hz) { - dev_err(controller->dev, "invalid max_speed_hz %d\n", - spi->max_speed_hz); - return -EINVAL; - } - if (!chip) { /* First setup */ chip = kzalloc(sizeof(*chip), GFP_KERNEL); @@ -629,6 +616,7 @@ static int spi_qup_probe(struct platform_device *pdev) master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP; master->num_chipselect = SPI_NUM_CHIPSELECTS; master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32); + master->max_speed_hz = max_freq; master->setup = spi_qup_setup; master->cleanup = spi_qup_cleanup; master->set_cs = spi_qup_set_cs; @@ -645,7 +633,6 @@ static int spi_qup_probe(struct platform_device *pdev) controller->iclk = iclk; controller->cclk = cclk; controller->irq = irq; - controller->max_speed_hz = max_freq; spin_lock_init(&controller->lock); init_completion(&controller->done);