From patchwork Wed Mar 27 02:37:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Warren X-Patchwork-Id: 2347081 Return-Path: X-Original-To: patchwork-spi-devel-general@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by patchwork1.kernel.org (Postfix) with ESMTP id 27E223FD40 for ; Wed, 27 Mar 2013 02:38:23 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1UKgFq-0003MP-J2; Wed, 27 Mar 2013 02:38:22 +0000 Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1UKgFn-0003Ly-RA for spi-devel-general@lists.sourceforge.net; Wed, 27 Mar 2013 02:38:19 +0000 Received-SPF: pass (sog-mx-3.v43.ch3.sourceforge.com: domain of wwwdotorg.org designates 70.85.31.133 as permitted sender) client-ip=70.85.31.133; envelope-from=swarren@wwwdotorg.org; helo=avon.wwwdotorg.org; Received: from avon.wwwdotorg.org ([70.85.31.133]) by sog-mx-3.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1UKgFm-0001Xw-3V for spi-devel-general@lists.sourceforge.net; Wed, 27 Mar 2013 02:38:19 +0000 Received: from severn.wwwdotorg.org (unknown [192.168.65.5]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by avon.wwwdotorg.org (Postfix) with ESMTPS id 902446446; Tue, 26 Mar 2013 20:38:31 -0600 (MDT) Received: from dart.wwwdotorg.org (c-98-245-170-70.hsd1.co.comcast.net [98.245.170.70]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by severn.wwwdotorg.org (Postfix) with ESMTPSA id 2399EE460E; Tue, 26 Mar 2013 20:38:11 -0600 (MDT) From: Stephen Warren To: Grant Likely , Mark Brown Subject: [PATCH 2/2] spi: bcm2835: make use of new bits_per_word_mask core feature Date: Tue, 26 Mar 2013 20:37:58 -0600 Message-Id: <1364351878-26089-2-git-send-email-swarren@wwwdotorg.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1364351878-26089-1-git-send-email-swarren@wwwdotorg.org> References: <1364351878-26089-1-git-send-email-swarren@wwwdotorg.org> X-NVConfidentiality: public X-Virus-Scanned: clamav-milter 0.96.5 at avon.wwwdotorg.org X-Virus-Status: Clean X-Spam-Score: -2.8 (--) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record -1.3 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain X-Headers-End: 1UKgFm-0001Xw-3V Cc: spi-devel-general@lists.sourceforge.net, Stephen Warren X-BeenThere: spi-devel-general@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux SPI core/device drivers discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: spi-devel-general-bounces@lists.sourceforge.net This driver only supports bits_per_word==8, so inform the SPI core of this. Remove all the open-coded validation that's no longer needed. Signed-off-by: Stephen Warren --- This only converts one driver, but if the concept is acceptable, I'll try to take a look at other drivers and convert them too. drivers/spi/spi-bcm2835.c | 36 +----------------------------------- 1 file changed, 1 insertion(+), 35 deletions(-) diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c index 346601e..89c0b50 100644 --- a/drivers/spi/spi-bcm2835.c +++ b/drivers/spi/spi-bcm2835.c @@ -182,23 +182,6 @@ static irqreturn_t bcm2835_spi_interrupt(int irq, void *dev_id) return IRQ_NONE; } -static int bcm2835_spi_check_transfer(struct spi_device *spi, - struct spi_transfer *tfr) -{ - /* tfr==NULL when called from bcm2835_spi_setup() */ - u32 bpw = tfr ? tfr->bits_per_word : spi->bits_per_word; - - switch (bpw) { - case 8: - break; - default: - dev_err(&spi->dev, "unsupported bits_per_word=%d\n", bpw); - return -EINVAL; - } - - return 0; -} - static int bcm2835_spi_start_transfer(struct spi_device *spi, struct spi_transfer *tfr) { @@ -273,19 +256,6 @@ static int bcm2835_spi_finish_transfer(struct spi_device *spi, return 0; } -static int bcm2835_spi_setup(struct spi_device *spi) -{ - int ret; - - ret = bcm2835_spi_check_transfer(spi, NULL); - if (ret) { - dev_err(&spi->dev, "setup: invalid message\n"); - return ret; - } - - return 0; -} - static int bcm2835_spi_transfer_one(struct spi_master *master, struct spi_message *mesg) { @@ -297,10 +267,6 @@ static int bcm2835_spi_transfer_one(struct spi_master *master, bool cs_change; list_for_each_entry(tfr, &mesg->transfers, transfer_list) { - err = bcm2835_spi_check_transfer(spi, tfr); - if (err) - goto out; - err = bcm2835_spi_start_transfer(spi, tfr); if (err) goto out; @@ -348,9 +314,9 @@ static int bcm2835_spi_probe(struct platform_device *pdev) platform_set_drvdata(pdev, master); master->mode_bits = BCM2835_SPI_MODE_BITS; + master->bits_per_word_mask = BIT(8 - 1); master->bus_num = -1; master->num_chipselect = 3; - master->setup = bcm2835_spi_setup; master->transfer_one_message = bcm2835_spi_transfer_one; master->dev.of_node = pdev->dev.of_node;