Signed-off-by: Chuanhua Han chuanhua.han@nxp.com --- Changes in v2: - Place the adjusted transfer bytes code in spi_mem_adjust_op_size() and check spi_max_message_size(mem->spi) value before subtracting opcode, addr and dummy bytes. *fixes: spi: Extend the core to ease integration of SPI memory controllers --- drivers/spi/spi-mem.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c index 990770d..f5e75d1 100644 --- a/drivers/spi/spi-mem.c +++ b/drivers/spi/spi-mem.c @@ -328,10 +328,21 @@ EXPORT_SYMBOL_GPL(spi_mem_exec_op); int spi_mem_adjust_op_size(struct spi_mem *mem, struct spi_mem_op *op) { struct spi_controller *ctlr = mem->spi->controller; + unsigned long val = sizeof(op->cmd.opcode) + + op->addr.nbytes + + op->dummy.nbytes;
if (ctlr->mem_ops && ctlr->mem_ops->adjust_op_size) return ctlr->mem_ops->adjust_op_size(mem, op);
+ if (spi_max_message_size(mem->spi) < val) + return -EINVAL; + + if (!ctlr->mem_ops || !ctlr->mem_ops->exec_op) + op->data.nbytes = min3((unsigned long)op->data.nbytes, + spi_max_transfer_size(mem->spi), + spi_max_message_size(mem->spi) - val); + return 0; } EXPORT_SYMBOL_GPL(spi_mem_adjust_op_size);
Hi Chuanhua,
On Mon, 20 Aug 2018 17:43:26 +0800 Chuanhua Han chuanhua.han@nxp.com wrote:
Subject prefix should be "spi: spi-mem: " not "mtd: m25p80: ", and you need a commit message explaining what this patch does and why it's needed.
Signed-off-by: Chuanhua Han chuanhua.han@nxp.com
Fixes: c36ff266dc82 ("spi: Extend the core to ease integration of SPI memory controllers") Cc: stable@vger.kernel.org
Changes in v2:
- Place the adjusted transfer bytes code in spi_mem_adjust_op_size()
and check spi_max_message_size(mem->spi) value before subtracting opcode, addr and dummy bytes. *fixes: spi: Extend the core to ease integration of SPI memory controllers
drivers/spi/spi-mem.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c index 990770d..f5e75d1 100644 --- a/drivers/spi/spi-mem.c +++ b/drivers/spi/spi-mem.c @@ -328,10 +328,21 @@ EXPORT_SYMBOL_GPL(spi_mem_exec_op); int spi_mem_adjust_op_size(struct spi_mem *mem, struct spi_mem_op *op) { struct spi_controller *ctlr = mem->spi->controller;
- unsigned long val = sizeof(op->cmd.opcode) +
op->addr.nbytes +
op->dummy.nbytes;
Not properly aligned, and you should find a better name for this variable.
if (ctlr->mem_ops && ctlr->mem_ops->adjust_op_size) return ctlr->mem_ops->adjust_op_size(mem, op);
- if (spi_max_message_size(mem->spi) < val)
return -EINVAL;
This should be enclosed in the if (!ctlr->mem_ops || !ctlr->mem_ops->exec_op) block and you should check that spi_max_transfer_size(mem->spi) >= val too.
- if (!ctlr->mem_ops || !ctlr->mem_ops->exec_op)
op->data.nbytes = min3((unsigned long)op->data.nbytes,
spi_max_transfer_size(mem->spi),
spi_max_message_size(mem->spi) - val);
- return 0;
} EXPORT_SYMBOL_GPL(spi_mem_adjust_op_size);
Regards,
Boris
Hi Chuanhua,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on spi/for-next] [also build test WARNING on v4.18 next-20180817] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Chuanhua-Han/mtd-m25p80-consider-ma... base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next config: i386-randconfig-x076-201833 (attached as .config) compiler: gcc-7 (Debian 7.3.0-16) 7.3.0 reproduce: # save the attached .config to linux build tree make ARCH=i386
All warnings (new ones prefixed by >>):
In file included from include/linux/list.h:9:0, from include/linux/kobject.h:19, from include/linux/device.h:16, from include/linux/dmaengine.h:20, from drivers/spi/spi-mem.c:8: drivers/spi/spi-mem.c: In function 'spi_mem_adjust_op_size': include/linux/kernel.h:812:29: warning: comparison of distinct pointer types lacks a cast (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1))) ^ include/linux/kernel.h:826:4: note: in expansion of macro '__typecheck' (__typecheck(x, y) && __no_side_effects(x, y)) ^~~~~~~~~~~ include/linux/kernel.h:836:24: note: in expansion of macro '__safe_cmp' __builtin_choose_expr(__safe_cmp(x, y), \ ^~~~~~~~~~ include/linux/kernel.h:845:19: note: in expansion of macro '__careful_cmp' #define min(x, y) __careful_cmp(x, y, <) ^~~~~~~~~~~~~
include/linux/kernel.h:860:23: note: in expansion of macro 'min'
#define min3(x, y, z) min((typeof(x))min(x, y), z) ^~~ include/linux/kernel.h:826:4: note: in expansion of macro '__typecheck' (__typecheck(x, y) && __no_side_effects(x, y)) ^~~~~~~~~~~ include/linux/kernel.h:836:24: note: in expansion of macro '__safe_cmp' __builtin_choose_expr(__safe_cmp(x, y), \ ^~~~~~~~~~ include/linux/kernel.h:845:19: note: in expansion of macro '__careful_cmp' #define min(x, y) __careful_cmp(x, y, <) ^~~~~~~~~~~~~ include/linux/kernel.h:860:38: note: in expansion of macro 'min' #define min3(x, y, z) min((typeof(x))min(x, y), z) ^~~
drivers/spi/spi-mem.c:360:21: note: in expansion of macro 'min3'
op->data.nbytes = min3((unsigned long)op->data.nbytes, ^~~~ include/linux/kernel.h:812:29: warning: comparison of distinct pointer types lacks a cast (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1))) ^ include/linux/kernel.h:820:48: note: in definition of macro '__is_constexpr' (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8))) ^ include/linux/kernel.h:826:25: note: in expansion of macro '__no_side_effects' (__typecheck(x, y) && __no_side_effects(x, y)) ^~~~~~~~~~~~~~~~~ include/linux/kernel.h:836:24: note: in expansion of macro '__safe_cmp' __builtin_choose_expr(__safe_cmp(x, y), \ ^~~~~~~~~~ include/linux/kernel.h:845:19: note: in expansion of macro '__careful_cmp' #define min(x, y) __careful_cmp(x, y, <) ^~~~~~~~~~~~~
include/linux/kernel.h:860:23: note: in expansion of macro 'min'
#define min3(x, y, z) min((typeof(x))min(x, y), z) ^~~ include/linux/kernel.h:826:4: note: in expansion of macro '__typecheck' (__typecheck(x, y) && __no_side_effects(x, y)) ^~~~~~~~~~~ include/linux/kernel.h:836:24: note: in expansion of macro '__safe_cmp' __builtin_choose_expr(__safe_cmp(x, y), \ ^~~~~~~~~~ include/linux/kernel.h:845:19: note: in expansion of macro '__careful_cmp' #define min(x, y) __careful_cmp(x, y, <) ^~~~~~~~~~~~~ include/linux/kernel.h:860:38: note: in expansion of macro 'min' #define min3(x, y, z) min((typeof(x))min(x, y), z) ^~~
drivers/spi/spi-mem.c:360:21: note: in expansion of macro 'min3'
op->data.nbytes = min3((unsigned long)op->data.nbytes, ^~~~ include/linux/kernel.h:812:29: warning: comparison of distinct pointer types lacks a cast (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1))) ^ include/linux/kernel.h:828:27: note: in definition of macro '__cmp' #define __cmp(x, y, op) ((x) op (y) ? (x) : (y)) ^ include/linux/kernel.h:845:19: note: in expansion of macro '__careful_cmp' #define min(x, y) __careful_cmp(x, y, <) ^~~~~~~~~~~~~
include/linux/kernel.h:860:23: note: in expansion of macro 'min'
#define min3(x, y, z) min((typeof(x))min(x, y), z) ^~~ include/linux/kernel.h:826:4: note: in expansion of macro '__typecheck' (__typecheck(x, y) && __no_side_effects(x, y)) ^~~~~~~~~~~ include/linux/kernel.h:836:24: note: in expansion of macro '__safe_cmp' __builtin_choose_expr(__safe_cmp(x, y), \ ^~~~~~~~~~ include/linux/kernel.h:845:19: note: in expansion of macro '__careful_cmp' #define min(x, y) __careful_cmp(x, y, <) ^~~~~~~~~~~~~ include/linux/kernel.h:860:38: note: in expansion of macro 'min' #define min3(x, y, z) min((typeof(x))min(x, y), z) ^~~
drivers/spi/spi-mem.c:360:21: note: in expansion of macro 'min3'
op->data.nbytes = min3((unsigned long)op->data.nbytes, ^~~~ include/linux/kernel.h:812:29: warning: comparison of distinct pointer types lacks a cast (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1))) ^ include/linux/kernel.h:828:40: note: in definition of macro '__cmp' #define __cmp(x, y, op) ((x) op (y) ? (x) : (y)) ^ include/linux/kernel.h:845:19: note: in expansion of macro '__careful_cmp' #define min(x, y) __careful_cmp(x, y, <) ^~~~~~~~~~~~~
include/linux/kernel.h:860:23: note: in expansion of macro 'min'
#define min3(x, y, z) min((typeof(x))min(x, y), z) ^~~ include/linux/kernel.h:826:4: note: in expansion of macro '__typecheck' (__typecheck(x, y) && __no_side_effects(x, y)) ^~~~~~~~~~~ include/linux/kernel.h:836:24: note: in expansion of macro '__safe_cmp' __builtin_choose_expr(__safe_cmp(x, y), \ ^~~~~~~~~~ include/linux/kernel.h:845:19: note: in expansion of macro '__careful_cmp' #define min(x, y) __careful_cmp(x, y, <) ^~~~~~~~~~~~~ include/linux/kernel.h:860:38: note: in expansion of macro 'min' #define min3(x, y, z) min((typeof(x))min(x, y), z) ^~~
drivers/spi/spi-mem.c:360:21: note: in expansion of macro 'min3'
op->data.nbytes = min3((unsigned long)op->data.nbytes, ^~~~ include/linux/kernel.h:812:29: warning: comparison of distinct pointer types lacks a cast (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1))) ^ include/linux/kernel.h:831:10: note: in definition of macro '__cmp_once' typeof(x) unique_x = (x); \ ^ include/linux/kernel.h:845:19: note: in expansion of macro '__careful_cmp' #define min(x, y) __careful_cmp(x, y, <) ^~~~~~~~~~~~~
include/linux/kernel.h:860:23: note: in expansion of macro 'min'
#define min3(x, y, z) min((typeof(x))min(x, y), z) ^~~ include/linux/kernel.h:826:4: note: in expansion of macro '__typecheck' (__typecheck(x, y) && __no_side_effects(x, y)) ^~~~~~~~~~~ include/linux/kernel.h:836:24: note: in expansion of macro '__safe_cmp' __builtin_choose_expr(__safe_cmp(x, y), \ ^~~~~~~~~~ include/linux/kernel.h:845:19: note: in expansion of macro '__careful_cmp' #define min(x, y) __careful_cmp(x, y, <) ^~~~~~~~~~~~~ include/linux/kernel.h:860:38: note: in expansion of macro 'min' #define min3(x, y, z) min((typeof(x))min(x, y), z) ^~~
drivers/spi/spi-mem.c:360:21: note: in expansion of macro 'min3'
op->data.nbytes = min3((unsigned long)op->data.nbytes, ^~~~ include/linux/kernel.h:812:29: warning: comparison of distinct pointer types lacks a cast (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1))) ^ include/linux/kernel.h:831:25: note: in definition of macro '__cmp_once' typeof(x) unique_x = (x); \ ^ include/linux/kernel.h:845:19: note: in expansion of macro '__careful_cmp' #define min(x, y) __careful_cmp(x, y, <) ^~~~~~~~~~~~~
include/linux/kernel.h:860:23: note: in expansion of macro 'min'
#define min3(x, y, z) min((typeof(x))min(x, y), z) ^~~ include/linux/kernel.h:826:4: note: in expansion of macro '__typecheck' (__typecheck(x, y) && __no_side_effects(x, y)) ^~~~~~~~~~~ include/linux/kernel.h:836:24: note: in expansion of macro '__safe_cmp' __builtin_choose_expr(__safe_cmp(x, y), \ ^~~~~~~~~~ include/linux/kernel.h:845:19: note: in expansion of macro '__careful_cmp' #define min(x, y) __careful_cmp(x, y, <) ^~~~~~~~~~~~~ include/linux/kernel.h:860:38: note: in expansion of macro 'min' #define min3(x, y, z) min((typeof(x))min(x, y), z) ^~~
drivers/spi/spi-mem.c:360:21: note: in expansion of macro 'min3'
op->data.nbytes = min3((unsigned long)op->data.nbytes, ^~~~ -- In file included from include/linux/list.h:9:0, from include/linux/kobject.h:19, from include/linux/device.h:16, from include/linux/dmaengine.h:20, from drivers//spi/spi-mem.c:8: drivers//spi/spi-mem.c: In function 'spi_mem_adjust_op_size': include/linux/kernel.h:812:29: warning: comparison of distinct pointer types lacks a cast (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1))) ^ include/linux/kernel.h:826:4: note: in expansion of macro '__typecheck' (__typecheck(x, y) && __no_side_effects(x, y)) ^~~~~~~~~~~ include/linux/kernel.h:836:24: note: in expansion of macro '__safe_cmp' __builtin_choose_expr(__safe_cmp(x, y), \ ^~~~~~~~~~ include/linux/kernel.h:845:19: note: in expansion of macro '__careful_cmp' #define min(x, y) __careful_cmp(x, y, <) ^~~~~~~~~~~~~
include/linux/kernel.h:860:23: note: in expansion of macro 'min'
#define min3(x, y, z) min((typeof(x))min(x, y), z) ^~~ include/linux/kernel.h:826:4: note: in expansion of macro '__typecheck' (__typecheck(x, y) && __no_side_effects(x, y)) ^~~~~~~~~~~ include/linux/kernel.h:836:24: note: in expansion of macro '__safe_cmp' __builtin_choose_expr(__safe_cmp(x, y), \ ^~~~~~~~~~ include/linux/kernel.h:845:19: note: in expansion of macro '__careful_cmp' #define min(x, y) __careful_cmp(x, y, <) ^~~~~~~~~~~~~ include/linux/kernel.h:860:38: note: in expansion of macro 'min' #define min3(x, y, z) min((typeof(x))min(x, y), z) ^~~ drivers//spi/spi-mem.c:360:21: note: in expansion of macro 'min3' op->data.nbytes = min3((unsigned long)op->data.nbytes, ^~~~ include/linux/kernel.h:812:29: warning: comparison of distinct pointer types lacks a cast (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1))) ^ include/linux/kernel.h:820:48: note: in definition of macro '__is_constexpr' (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8))) ^ include/linux/kernel.h:826:25: note: in expansion of macro '__no_side_effects' (__typecheck(x, y) && __no_side_effects(x, y)) ^~~~~~~~~~~~~~~~~ include/linux/kernel.h:836:24: note: in expansion of macro '__safe_cmp' __builtin_choose_expr(__safe_cmp(x, y), \ ^~~~~~~~~~ include/linux/kernel.h:845:19: note: in expansion of macro '__careful_cmp' #define min(x, y) __careful_cmp(x, y, <) ^~~~~~~~~~~~~
include/linux/kernel.h:860:23: note: in expansion of macro 'min'
#define min3(x, y, z) min((typeof(x))min(x, y), z) ^~~ include/linux/kernel.h:826:4: note: in expansion of macro '__typecheck' (__typecheck(x, y) && __no_side_effects(x, y)) ^~~~~~~~~~~ include/linux/kernel.h:836:24: note: in expansion of macro '__safe_cmp' __builtin_choose_expr(__safe_cmp(x, y), \ ^~~~~~~~~~ include/linux/kernel.h:845:19: note: in expansion of macro '__careful_cmp' #define min(x, y) __careful_cmp(x, y, <) ^~~~~~~~~~~~~ include/linux/kernel.h:860:38: note: in expansion of macro 'min' #define min3(x, y, z) min((typeof(x))min(x, y), z) ^~~ drivers//spi/spi-mem.c:360:21: note: in expansion of macro 'min3' op->data.nbytes = min3((unsigned long)op->data.nbytes, ^~~~ include/linux/kernel.h:812:29: warning: comparison of distinct pointer types lacks a cast (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1))) ^ include/linux/kernel.h:828:27: note: in definition of macro '__cmp' #define __cmp(x, y, op) ((x) op (y) ? (x) : (y)) ^ include/linux/kernel.h:845:19: note: in expansion of macro '__careful_cmp' #define min(x, y) __careful_cmp(x, y, <) ^~~~~~~~~~~~~
include/linux/kernel.h:860:23: note: in expansion of macro 'min'
#define min3(x, y, z) min((typeof(x))min(x, y), z) ^~~ include/linux/kernel.h:826:4: note: in expansion of macro '__typecheck' (__typecheck(x, y) && __no_side_effects(x, y)) ^~~~~~~~~~~ include/linux/kernel.h:836:24: note: in expansion of macro '__safe_cmp' __builtin_choose_expr(__safe_cmp(x, y), \ ^~~~~~~~~~ include/linux/kernel.h:845:19: note: in expansion of macro '__careful_cmp' #define min(x, y) __careful_cmp(x, y, <) ^~~~~~~~~~~~~ include/linux/kernel.h:860:38: note: in expansion of macro 'min' #define min3(x, y, z) min((typeof(x))min(x, y), z) ^~~ drivers//spi/spi-mem.c:360:21: note: in expansion of macro 'min3' op->data.nbytes = min3((unsigned long)op->data.nbytes, ^~~~ include/linux/kernel.h:812:29: warning: comparison of distinct pointer types lacks a cast (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1))) ^ include/linux/kernel.h:828:40: note: in definition of macro '__cmp' #define __cmp(x, y, op) ((x) op (y) ? (x) : (y)) ^ include/linux/kernel.h:845:19: note: in expansion of macro '__careful_cmp' #define min(x, y) __careful_cmp(x, y, <) ^~~~~~~~~~~~~
include/linux/kernel.h:860:23: note: in expansion of macro 'min'
#define min3(x, y, z) min((typeof(x))min(x, y), z) ^~~ include/linux/kernel.h:826:4: note: in expansion of macro '__typecheck' (__typecheck(x, y) && __no_side_effects(x, y)) ^~~~~~~~~~~ include/linux/kernel.h:836:24: note: in expansion of macro '__safe_cmp' __builtin_choose_expr(__safe_cmp(x, y), \ ^~~~~~~~~~ include/linux/kernel.h:845:19: note: in expansion of macro '__careful_cmp' #define min(x, y) __careful_cmp(x, y, <) ^~~~~~~~~~~~~ include/linux/kernel.h:860:38: note: in expansion of macro 'min' #define min3(x, y, z) min((typeof(x))min(x, y), z) ^~~ drivers//spi/spi-mem.c:360:21: note: in expansion of macro 'min3' op->data.nbytes = min3((unsigned long)op->data.nbytes, ^~~~ include/linux/kernel.h:812:29: warning: comparison of distinct pointer types lacks a cast (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1))) ^ include/linux/kernel.h:831:10: note: in definition of macro '__cmp_once' typeof(x) unique_x = (x); \ ^ include/linux/kernel.h:845:19: note: in expansion of macro '__careful_cmp' #define min(x, y) __careful_cmp(x, y, <) ^~~~~~~~~~~~~
include/linux/kernel.h:860:23: note: in expansion of macro 'min'
#define min3(x, y, z) min((typeof(x))min(x, y), z) ^~~ include/linux/kernel.h:826:4: note: in expansion of macro '__typecheck' (__typecheck(x, y) && __no_side_effects(x, y)) ^~~~~~~~~~~ include/linux/kernel.h:836:24: note: in expansion of macro '__safe_cmp' __builtin_choose_expr(__safe_cmp(x, y), \ ^~~~~~~~~~ include/linux/kernel.h:845:19: note: in expansion of macro '__careful_cmp' #define min(x, y) __careful_cmp(x, y, <) ^~~~~~~~~~~~~ include/linux/kernel.h:860:38: note: in expansion of macro 'min' #define min3(x, y, z) min((typeof(x))min(x, y), z) ^~~ drivers//spi/spi-mem.c:360:21: note: in expansion of macro 'min3' op->data.nbytes = min3((unsigned long)op->data.nbytes, ^~~~ include/linux/kernel.h:812:29: warning: comparison of distinct pointer types lacks a cast (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1))) ^ include/linux/kernel.h:831:25: note: in definition of macro '__cmp_once' typeof(x) unique_x = (x); \ ^ include/linux/kernel.h:845:19: note: in expansion of macro '__careful_cmp' #define min(x, y) __careful_cmp(x, y, <) ^~~~~~~~~~~~~
include/linux/kernel.h:860:23: note: in expansion of macro 'min'
#define min3(x, y, z) min((typeof(x))min(x, y), z) ^~~ include/linux/kernel.h:826:4: note: in expansion of macro '__typecheck' (__typecheck(x, y) && __no_side_effects(x, y)) ^~~~~~~~~~~ include/linux/kernel.h:836:24: note: in expansion of macro '__safe_cmp' __builtin_choose_expr(__safe_cmp(x, y), \ ^~~~~~~~~~ include/linux/kernel.h:845:19: note: in expansion of macro '__careful_cmp' #define min(x, y) __careful_cmp(x, y, <) ^~~~~~~~~~~~~ include/linux/kernel.h:860:38: note: in expansion of macro 'min' #define min3(x, y, z) min((typeof(x))min(x, y), z) ^~~ drivers//spi/spi-mem.c:360:21: note: in expansion of macro 'min3' op->data.nbytes = min3((unsigned long)op->data.nbytes, ^~~~
vim +/min3 +360 drivers/spi/spi-mem.c
330 331 /** 332 * spi_mem_adjust_op_size() - Adjust the data size of a SPI mem operation to 333 * match controller limitations 334 * @mem: the SPI memory 335 * @op: the operation to adjust 336 * 337 * Some controllers have FIFO limitations and must split a data transfer 338 * operation into multiple ones, others require a specific alignment for 339 * optimized accesses. This function allows SPI mem drivers to split a single 340 * operation into multiple sub-operations when required. 341 * 342 * Return: a negative error code if the controller can't properly adjust @op, 343 * 0 otherwise. Note that @op->data.nbytes will be updated if @op 344 * can't be handled in a single step. 345 */ 346 int spi_mem_adjust_op_size(struct spi_mem *mem, struct spi_mem_op *op) 347 { 348 struct spi_controller *ctlr = mem->spi->controller; 349 unsigned long val = sizeof(op->cmd.opcode) + 350 op->addr.nbytes + 351 op->dummy.nbytes; 352 353 if (ctlr->mem_ops && ctlr->mem_ops->adjust_op_size) 354 return ctlr->mem_ops->adjust_op_size(mem, op); 355 356 if (spi_max_message_size(mem->spi) < val) 357 return -EINVAL; 358 359 if (!ctlr->mem_ops || !ctlr->mem_ops->exec_op)
360 op->data.nbytes = min3((unsigned long)op->data.nbytes,
361 spi_max_transfer_size(mem->spi), 362 spi_max_message_size(mem->spi) - val); 363 364 return 0; 365 } 366 EXPORT_SYMBOL_GPL(spi_mem_adjust_op_size); 367
--- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
On Mon, Aug 20, 2018 at 05:43:26PM +0800, Chuanhua Han wrote:
Signed-off-by: Chuanhua Han chuanhua.han@nxp.com
Changes in v2:
- Place the adjusted transfer bytes code in spi_mem_adjust_op_size()
and check spi_max_message_size(mem->spi) value before subtracting opcode, addr and dummy bytes. *fixes: spi: Extend the core to ease integration of SPI memory controllers
drivers/spi/spi-mem.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
<formletter>
This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read: https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html for how to do this properly.
</formletter>
linux-stable-mirror@lists.linaro.org