From patchwork Fri May 17 19:40:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13667342 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 54EB7140366; Fri, 17 May 2024 19:41:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715974874; cv=none; b=LzB6/e4J85W3fNowupxIrukk+4WJUgzODIGVe9sYbJcg0idxYAHyLOhW+aF0z5UOWw9LbtBpYlIr+JRHahRI+Qenw7kRkr/XhpEuk6cMWn0hiTntROpCCQeLkc4GoQL7H9CO9ZsdYpHZepKmy3A+1DzIVmeA+tyg/ZZ3Go/iIoI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715974874; c=relaxed/simple; bh=96N7qe/v17ZlBpVlNgzHkjLLMJgeHxXPuDVUsLGh+k4=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BIC9Gy0rySUKDkNo+U12eQfXTgIXyIZFL780J54XS2llo1X93XHEOQGSA6L5mCrcxeL8eK9zGt2PQKMbddasCpXj3+X9nMeDupuUSRuTEnB75YLEWEnQ7BD4a7a+H7bf74oZk7A0QYtVLn1S0ytfzCgvRPNjlTntAJ3gZzOHt5g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=mUfP/QMK; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="mUfP/QMK" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715974872; x=1747510872; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=96N7qe/v17ZlBpVlNgzHkjLLMJgeHxXPuDVUsLGh+k4=; b=mUfP/QMKNsQ5Qg5yadxBJcftZ4k3qx4424xsXktoRJtjUsE+I+cGLvjF /yUvnvJZ+DTJTuCpblj6ETdDIFfdO1Nm/fZPNGLUV29QlaZ/Va0Xnb6FJ 6o2VF4jlBE7/0evpBoKKgGDl6/7ceSPTLD4CCbxv54wzvFVNmSHiq+xLN 3Agp2fkeTBSZaTLHDzvAMsK2EzqD3eNjKiPNfOe0RAbJ88WnqsUomSWfN GPmh0NF2s3Yzwh+urPHXEBXze1o2PWA4DOfU82096BorjO/JrF/gBptQc MO8cGAH/hVw86/+0v/cR5aSj2xMohpR1hULtuf0T/lVV6yn2XRiUQZwq2 A==; X-CSE-ConnectionGUID: 6L93flwOQBilhX3NkUXMbg== X-CSE-MsgGUID: MoFGCv3uRtieGzwAp1neFg== X-IronPort-AV: E=McAfee;i="6600,9927,11075"; a="22783103" X-IronPort-AV: E=Sophos;i="6.08,168,1712646000"; d="scan'208";a="22783103" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2024 12:41:10 -0700 X-CSE-ConnectionGUID: S3qoplqCQd2p+BMbgzh4gQ== X-CSE-MsgGUID: Fq/gPlBfSHOlVlgo/8Uwdg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,168,1712646000"; d="scan'208";a="32503704" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa007.jf.intel.com with ESMTP; 17 May 2024 12:41:09 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 57155118; Fri, 17 May 2024 22:41:07 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Mark Brown , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 1/3] spi: bitbang: Use typedef for txrx_*() callbacks Date: Fri, 17 May 2024 22:40:20 +0300 Message-ID: <20240517194104.747328-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240517194104.747328-1-andriy.shevchenko@linux.intel.com> References: <20240517194104.747328-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 With a typedef for the txrx_*() callbacks the code looks neater. Note that typedef for a function is okay to have. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-bitbang.c | 31 +++++++++---------------------- include/linux/spi/spi_bitbang.h | 7 ++++--- 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/drivers/spi/spi-bitbang.c b/drivers/spi/spi-bitbang.c index ca5cc67555c5..d88110acdc5f 100644 --- a/drivers/spi/spi-bitbang.c +++ b/drivers/spi/spi-bitbang.c @@ -38,26 +38,19 @@ * working quickly, or testing for differences that aren't speed related. */ +typedef unsigned int (*spi_bb_txrx_bufs_fn)(struct spi_device *, spi_bb_txrx_word_fn, + unsigned int, struct spi_transfer *, + unsigned int); + struct spi_bitbang_cs { unsigned nsecs; /* (clock cycle time)/2 */ - u32 (*txrx_word)(struct spi_device *spi, unsigned nsecs, - u32 word, u8 bits, unsigned flags); - unsigned (*txrx_bufs)(struct spi_device *, - u32 (*txrx_word)( - struct spi_device *spi, - unsigned nsecs, - u32 word, u8 bits, - unsigned flags), - unsigned, struct spi_transfer *, - unsigned); + spi_bb_txrx_word_fn txrx_word; + spi_bb_txrx_bufs_fn txrx_bufs; }; static unsigned bitbang_txrx_8( struct spi_device *spi, - u32 (*txrx_word)(struct spi_device *spi, - unsigned nsecs, - u32 word, u8 bits, - unsigned flags), + spi_bb_txrx_word_fn txrx_word, unsigned ns, struct spi_transfer *t, unsigned flags @@ -83,10 +76,7 @@ static unsigned bitbang_txrx_8( static unsigned bitbang_txrx_16( struct spi_device *spi, - u32 (*txrx_word)(struct spi_device *spi, - unsigned nsecs, - u32 word, u8 bits, - unsigned flags), + spi_bb_txrx_word_fn txrx_word, unsigned ns, struct spi_transfer *t, unsigned flags @@ -112,10 +102,7 @@ static unsigned bitbang_txrx_16( static unsigned bitbang_txrx_32( struct spi_device *spi, - u32 (*txrx_word)(struct spi_device *spi, - unsigned nsecs, - u32 word, u8 bits, - unsigned flags), + spi_bb_txrx_word_fn txrx_word, unsigned ns, struct spi_transfer *t, unsigned flags diff --git a/include/linux/spi/spi_bitbang.h b/include/linux/spi/spi_bitbang.h index b930eca2ef7b..7ca08b430ed5 100644 --- a/include/linux/spi/spi_bitbang.h +++ b/include/linux/spi/spi_bitbang.h @@ -4,6 +4,8 @@ #include +typedef u32 (*spi_bb_txrx_word_fn)(struct spi_device *, unsigned int, u32, u8, unsigned int); + struct spi_bitbang { struct mutex lock; u8 busy; @@ -28,9 +30,8 @@ struct spi_bitbang { int (*txrx_bufs)(struct spi_device *spi, struct spi_transfer *t); /* txrx_word[SPI_MODE_*]() just looks like a shift register */ - u32 (*txrx_word[4])(struct spi_device *spi, - unsigned nsecs, - u32 word, u8 bits, unsigned flags); + spi_bb_txrx_word_fn txrx_word[4]; + int (*set_line_direction)(struct spi_device *spi, bool output); }; From patchwork Fri May 17 19:40:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13667341 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C856E60B9C; Fri, 17 May 2024 19:41:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715974872; cv=none; b=UNUfOlmfRAiYvsrR8BDvEBdtCDE43jjhVKW/8Nh3c1lT8DFscRYXjNymLKfk0DpxvvLtxii1hxR/2k9n9QjuN3YFKtkZkNEwmABqhCsyU9a3Ib6WWuPqdktspwrokqST7AmJAKNd+n3lPTfNMlWibJHo82LStcHWXlHTCuGmzLY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715974872; c=relaxed/simple; bh=cTQBxU02LeveXCRXj6bpQOjerEQ0zlysDmITzO6Sx+c=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ETy/b5pFAEYJEWkuTeffLIkUPKbZ4+BkAxCKsWK90/x45AwxPS8yfOFexrQlLXWyh2HGQDK35egXhOGTmEOBoqAnrq6XUEtxKsctRxYNhCuwahmi88n1DEskP9YhTgtq28spbeldfpJN6pLh4jSCIyxthMox5e1gumxtjoyTB/E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=mnIuEOfO; arc=none smtp.client-ip=198.175.65.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="mnIuEOfO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715974872; x=1747510872; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=cTQBxU02LeveXCRXj6bpQOjerEQ0zlysDmITzO6Sx+c=; b=mnIuEOfO9nYmKesu6Xt5YeKgWMWPLqoo11/kDzjpk+N0Nxs5j6HNboFl QaKM6dssqb35bHAxK/wYw73vZI9jpa5doc0+YK+OBu/Pi1pVCyBsinWfL JxjfcDAohIm1pMhndUdcxn5wpEtZ4T9wmftcsB1RFjSzJJlKDiHBw7Oyd lGoBPdFTwRjjHg/8KhWUKRNGM4aIrPGSEVCD3VFzeIMkToa/4ntVRMTli jmR9xzTKj/m+OjOSX8Jh8wCJRhZ2/RqLQ09UEv5lbKdW5fyOVMsHCAfc+ /pU6ImvsLGBFklk/LVCgqpt5A0TkokewEHvGM5p7r0f0A8BzPMC8zsfKa A==; X-CSE-ConnectionGUID: iqsam8g4QxC9EQWwA1XYRw== X-CSE-MsgGUID: JBFvuL0+RCq8ToLPHrz1eg== X-IronPort-AV: E=McAfee;i="6600,9927,11075"; a="29681808" X-IronPort-AV: E=Sophos;i="6.08,168,1712646000"; d="scan'208";a="29681808" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2024 12:41:11 -0700 X-CSE-ConnectionGUID: WvgmiBuLTvOTnrKrwJVSIA== X-CSE-MsgGUID: rwfz7ZUKSuCkxxCWufEULA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,168,1712646000"; d="scan'208";a="63081839" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa001.fm.intel.com with ESMTP; 17 May 2024 12:41:08 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 5C3FC2D2; Fri, 17 May 2024 22:41:07 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Mark Brown , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 2/3] spi: bitbang: Convert unsigned to unsigned int Date: Fri, 17 May 2024 22:40:21 +0300 Message-ID: <20240517194104.747328-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240517194104.747328-1-andriy.shevchenko@linux.intel.com> References: <20240517194104.747328-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Simple type conversion with no functional change implied. While at it, adjust indentation where it makes sense. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-bitbang.c | 42 +++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/drivers/spi/spi-bitbang.c b/drivers/spi/spi-bitbang.c index d88110acdc5f..afb1b1105ec2 100644 --- a/drivers/spi/spi-bitbang.c +++ b/drivers/spi/spi-bitbang.c @@ -43,21 +43,19 @@ typedef unsigned int (*spi_bb_txrx_bufs_fn)(struct spi_device *, spi_bb_txrx_wor unsigned int); struct spi_bitbang_cs { - unsigned nsecs; /* (clock cycle time)/2 */ + unsigned int nsecs; /* (clock cycle time) / 2 */ spi_bb_txrx_word_fn txrx_word; spi_bb_txrx_bufs_fn txrx_bufs; }; -static unsigned bitbang_txrx_8( - struct spi_device *spi, +static unsigned int bitbang_txrx_8(struct spi_device *spi, spi_bb_txrx_word_fn txrx_word, - unsigned ns, + unsigned int ns, struct spi_transfer *t, - unsigned flags -) + unsigned int flags) { - unsigned bits = t->bits_per_word; - unsigned count = t->len; + unsigned int bits = t->bits_per_word; + unsigned int count = t->len; const u8 *tx = t->tx_buf; u8 *rx = t->rx_buf; @@ -74,16 +72,14 @@ static unsigned bitbang_txrx_8( return t->len - count; } -static unsigned bitbang_txrx_16( - struct spi_device *spi, +static unsigned int bitbang_txrx_16(struct spi_device *spi, spi_bb_txrx_word_fn txrx_word, - unsigned ns, + unsigned int ns, struct spi_transfer *t, - unsigned flags -) + unsigned int flags) { - unsigned bits = t->bits_per_word; - unsigned count = t->len; + unsigned int bits = t->bits_per_word; + unsigned int count = t->len; const u16 *tx = t->tx_buf; u16 *rx = t->rx_buf; @@ -100,16 +96,14 @@ static unsigned bitbang_txrx_16( return t->len - count; } -static unsigned bitbang_txrx_32( - struct spi_device *spi, +static unsigned int bitbang_txrx_32(struct spi_device *spi, spi_bb_txrx_word_fn txrx_word, - unsigned ns, + unsigned int ns, struct spi_transfer *t, - unsigned flags -) + unsigned int flags) { - unsigned bits = t->bits_per_word; - unsigned count = t->len; + unsigned int bits = t->bits_per_word; + unsigned int count = t->len; const u32 *tx = t->tx_buf; u32 *rx = t->rx_buf; @@ -221,7 +215,7 @@ EXPORT_SYMBOL_GPL(spi_bitbang_cleanup); static int spi_bitbang_bufs(struct spi_device *spi, struct spi_transfer *t) { struct spi_bitbang_cs *cs = spi->controller_state; - unsigned nsecs = cs->nsecs; + unsigned int nsecs = cs->nsecs; struct spi_bitbang *bitbang; bitbang = spi_controller_get_devdata(spi->controller); @@ -234,7 +228,7 @@ static int spi_bitbang_bufs(struct spi_device *spi, struct spi_transfer *t) } if (spi->mode & SPI_3WIRE) { - unsigned flags; + unsigned int flags; flags = t->tx_buf ? SPI_CONTROLLER_NO_RX : SPI_CONTROLLER_NO_TX; return cs->txrx_bufs(spi, cs->txrx_word, nsecs, t, flags); From patchwork Fri May 17 19:40:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13667340 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CEA5F13DDB0; Fri, 17 May 2024 19:41:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715974872; cv=none; b=TYwSbBCFh51gNPmttJLoNqt8tDR7VafSTxIDrj0wbnPCBks91edzcANtpfMLLOLeAKdM6r5Nc/MXlIDRJmXDTpwUU2HXM+TBh18gssxPwYStCiiQqGh+q2loq0aVUCBe4BapKlt6erGSM1lKXsFJezye+/CAV8YYxJusgvlypB4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715974872; c=relaxed/simple; bh=fu2ycGfiDHO09k7hG2n7b4YA7Q5TXBs64qVIrhAtvt8=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=k9FC4hm04k8Od1chJV5bt6Azfou3pFid1Hlp5w+O6AlCPFO1bUeKhVRTrCIGrtH9RK/dua+9Iiyna4Gu4xQIQT/AVsAvdwKQ5J3aNHiIuXEbkF4qRTy7gvX+amDzw2U0DY5WUEp7qviucTEKBcXi3HAweTq4M4TuE8NR91AJ7Ps= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=LMpZE6WD; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="LMpZE6WD" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715974871; x=1747510871; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=fu2ycGfiDHO09k7hG2n7b4YA7Q5TXBs64qVIrhAtvt8=; b=LMpZE6WDh17BtvSi6CxAplGrwmLEJReQpFB0/HxagJ+TQukehS4K0KGg wfb3sq1hWtsj1sRNTQm1ud0ZwCao41idYiMXnrDNq6TrEKryj4SCE50/F btGllPiDTNf+ZTyEINSkIIqb0CvX15FaOOCbxUtAiRcgw24qsQ0VD1iQ/ k7QARoSoXIe7aboPV106UbJdIgGFFwqTts7fjB0G9XEBe6ChVuAwXjfVV W9QlRpBxIeRgjaG/iS4EEd3iccWf2sUROzGGTo++uRpVvK/y52xxHcQuk UuZ5eVmjzyRoFPUnkIrPwUmDdY/9CqTstajHsIt+eYBZuDH9IJg1xuoLR g==; X-CSE-ConnectionGUID: dvHHu8OTRHaWx6W2axOMEg== X-CSE-MsgGUID: QwwQ7ivkSTuWU42INeryag== X-IronPort-AV: E=McAfee;i="6600,9927,11075"; a="22783100" X-IronPort-AV: E=Sophos;i="6.08,168,1712646000"; d="scan'208";a="22783100" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2024 12:41:09 -0700 X-CSE-ConnectionGUID: x6nY/ggpQq6CNBcAPSPyVA== X-CSE-MsgGUID: sEUCPdqXSoysdRNhWW/50Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,168,1712646000"; d="scan'208";a="32503703" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa007.jf.intel.com with ESMTP; 17 May 2024 12:41:09 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 6F74B44E; Fri, 17 May 2024 22:41:07 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Mark Brown , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 3/3] spi: bitbang: Replace hard coded number of SPI modes Date: Fri, 17 May 2024 22:40:22 +0300 Message-ID: <20240517194104.747328-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240517194104.747328-1-andriy.shevchenko@linux.intel.com> References: <20240517194104.747328-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Instead of using hard coded number of modes, replace it with SPI_MODE_X_MASK + 1 to show relation to the SPI modes. Signed-off-by: Andy Shevchenko --- include/linux/spi/spi_bitbang.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/spi/spi_bitbang.h b/include/linux/spi/spi_bitbang.h index 7ca08b430ed5..d4cb83195f7a 100644 --- a/include/linux/spi/spi_bitbang.h +++ b/include/linux/spi/spi_bitbang.h @@ -30,7 +30,7 @@ struct spi_bitbang { int (*txrx_bufs)(struct spi_device *spi, struct spi_transfer *t); /* txrx_word[SPI_MODE_*]() just looks like a shift register */ - spi_bb_txrx_word_fn txrx_word[4]; + spi_bb_txrx_word_fn txrx_word[SPI_MODE_X_MASK + 1]; int (*set_line_direction)(struct spi_device *spi, bool output); };