From patchwork Fri Feb 21 01:34:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 3693081 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 6CF2CBF13A for ; Fri, 21 Feb 2014 01:34:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 91E9220173 for ; Fri, 21 Feb 2014 01:34:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ABDB220131 for ; Fri, 21 Feb 2014 01:34:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754807AbaBUBeW (ORCPT ); Thu, 20 Feb 2014 20:34:22 -0500 Received: from mail-pa0-f52.google.com ([209.85.220.52]:59886 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753670AbaBUBeV (ORCPT ); Thu, 20 Feb 2014 20:34:21 -0500 Received: by mail-pa0-f52.google.com with SMTP id bj1so2711775pad.25 for ; Thu, 20 Feb 2014 17:34:21 -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=C/bP6yQTwwYgdvqQ4NjXSMancXXjOOtru5iGXzbvJt/ad1sHBD7T2f9OOTGGN8+xsR zE/gxE4hA4UI0/EJ93UEzvIa5s8rWOfr/PjuHu8AikYmoip2nKz+MZCKFePzkkZGAFTJ Cmv6EJ1nR9xBqP20PqDzhYw0sXm+FSTBiSDRN3RBTD7szKPc+XrepkoMbSHbaJvdJTpA WW4Pclv+KerLC4fMN4T551gl2EuDw7TVvbh8xMl+PYAhk9V07pZk+/arSDIYU2FC9Nke hAI7un8+3NWD7LCyzlZa904zf92OGO4dUBUDVlLMc4P6z23zFfhS3ZGTTn6xHnILHCpT pg6Q== X-Gm-Message-State: ALoCoQl+H3UbMHMVvXDrCEymRBBqIWrlZ3ceV+m76EuG0MOrL5J+5nbiHmELyfcgH53DPS2HVOnC X-Received: by 10.66.182.199 with SMTP id eg7mr5715983pac.135.1392946461231; Thu, 20 Feb 2014 17:34:21 -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 ei4sm15543025pbb.42.2014.02.20.17.34.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Feb 2014 17:34:19 -0800 (PST) Message-ID: <1392946456.11510.2.camel@phoenix> Subject: [RESEND][PATCH 2/2] spi: qup: 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:34:16 +0800 In-Reply-To: <1392946396.11510.1.camel@phoenix> References: <1392946396.11510.1.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 --- 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);