Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp28848293rwd; Wed, 5 Jul 2023 03:45:40 -0700 (PDT) X-Google-Smtp-Source: APBJJlGfvMEGX66/QQI6LNfQuagykL7PxgKodLkjvNJL1tTQGMsl8EjaXVw0+zI5QOKeFNAChtMJ X-Received: by 2002:a05:6a00:228d:b0:653:de9a:d933 with SMTP id f13-20020a056a00228d00b00653de9ad933mr14860396pfe.17.1688553940469; Wed, 05 Jul 2023 03:45:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688553940; cv=none; d=google.com; s=arc-20160816; b=dHmerFM6/tOsrPClhHks9osaMk6fDouutUZ+m6G2q96FOPPv0lvjX1mJq1yhJllFn5 aLPb8tLdAZheu0TwN1byVSXI+y0gTDZWZuq0knLZTCXiL7wgATJQ0ZziadeJUhtPaJBh EcfK/KFxPylUvkUnSdtRcdrZ6wx0usCPXpUtgdVRRoD5cXALRtfotxBNoKbbcy9MHqDh 0Mugn5OyPkkKjMQr1fKsf1rGktUqTyqoxe4P9VeaMffxbCV/EEGNLiR3EkLKgXGDhMZv AOW+hOejSWjHb/HClvXT9mtSDhgqx+aUh3s8o5ICTz/htejG3UUrKoWVDPRvIWGeCMGY 2DRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:date:from; bh=Yinc6jbfGZDsmO7fug5wug0j8Nfj8Z0HOpCLguBAc+g=; fh=OADTMQA0ZPwB4hRRjm5DVX42NeOFmIY9eo8ftDeTH3g=; b=muQuSLLiQl6ok1UtGXHklPXtzTtT6TvBzj3uFRwjba5DFTiUvJtX16WFH0h+aJQh9I RCYZB5mBNZtWbZt+WsM3KRcXY3lhut4I7vz7zp4t1dYs+YZPrC8cJfha0EatAeJzR3B3 OGDt/ZEf4Z+0kg+N095wyHdiX15jUQ8IaVX7r2CjV1+A7RqEK7A2k2Ec2D4WNto4lVOy wVaUvs9pM4PbrokwgzYUgo7c6jol5cg6uWGgLoRfzwwNkz+bNqnKzAuzzAm2zl6Ao8Vt 86ahiHFPN0LzWp6ftpJq/kdVj1vHgsu82jYpRM+WXP1ccvcBNPKXIiOUpTf9gq5MhHZK FItA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c8-20020a631c08000000b005348fd7cb66si22793809pgc.873.2023.07.05.03.45.26; Wed, 05 Jul 2023 03:45:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231463AbjGEKR1 (ORCPT + 99 others); Wed, 5 Jul 2023 06:17:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230255AbjGEKRZ (ORCPT ); Wed, 5 Jul 2023 06:17:25 -0400 Received: from fgw22-7.mail.saunalahti.fi (fgw22-7.mail.saunalahti.fi [62.142.5.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EA9C180 for ; Wed, 5 Jul 2023 03:17:24 -0700 (PDT) Received: from localhost (88-113-24-87.elisa-laajakaista.fi [88.113.24.87]) by fgw22.mail.saunalahti.fi (Halon) with ESMTP id 20f0bf1a-1b1d-11ee-a9de-005056bdf889; Wed, 05 Jul 2023 13:17:22 +0300 (EEST) From: andy.shevchenko@gmail.com Date: Wed, 5 Jul 2023 13:17:21 +0300 To: Martin Kurbanov Cc: Mark Brown , Neil Armstrong , linux-spi@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@sberdevices.ru Subject: Re: [PATCH v1 1/2] spi: amlogic-spifc-a1: implement adjust_op_size() Message-ID: References: <20230703094518.53755-1-mmkurbanov@sberdevices.ru> <20230703094518.53755-2-mmkurbanov@sberdevices.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230703094518.53755-2-mmkurbanov@sberdevices.ru> X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FORGED_GMAIL_RCVD,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,SPF_HELO_NONE, SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Mon, Jul 03, 2023 at 12:45:17PM +0300, Martin Kurbanov kirjoitti: > This enhancement eliminates the need for a loop in the > amlogic_spifc_a1_exec_op() function and allows the SPI core to > dynamically divide transactions into appropriately sized chunks. ... > + if (!data_size) { Why not positive check? > + ret = amlogic_spifc_a1_request(spifc, false); > + } else { > + u32 mode = ilog2(op->data.buswidth); > > writel(0, spifc->base + SPIFC_A1_USER_DBUF_ADDR_REG); > > if (op->data.dir == SPI_MEM_DATA_IN) > - ret = amlogic_spifc_a1_read(spifc, > - op->data.buf.in + off, > - block_size, dmode); > + ret = amlogic_spifc_a1_read(spifc, op->data.buf.in, > + data_size, mode); > else > - ret = amlogic_spifc_a1_write(spifc, > - op->data.buf.out + off, > - block_size, dmode); > - > - nbytes -= block_size; > - off += block_size; > - } while (nbytes != 0 && !ret); > + ret = amlogic_spifc_a1_write(spifc, op->data.buf.out, > + data_size, mode); > + } ... > +static int amlogic_spifc_a1_adjust_op_size(struct spi_mem *mem, > + struct spi_mem_op *op) > +{ > + op->data.nbytes = min_t(u32, op->data.nbytes, SPIFC_A1_BUFFER_SIZE); I would rather use min() for strict type checking. In this case it will require to have U/u suffix in the SPIFC_A1_BUFFER_SIZE definition. > + return 0; > +} -- With Best Regards, Andy Shevchenko