Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp2424602imn; Tue, 2 Aug 2022 02:13:05 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sYSZxAGMnVy3+IVKzrYEYOhvzhh4I3Pw3tpX/WdoOGlaOnpBKBc+PsudEY6saKEM5arZbG X-Received: by 2002:a63:1e53:0:b0:41b:539c:7144 with SMTP id p19-20020a631e53000000b0041b539c7144mr16488127pgm.536.1659431585252; Tue, 02 Aug 2022 02:13:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659431585; cv=none; d=google.com; s=arc-20160816; b=bJgUovUqeMm+POHQf973xISM+i7otieuFAKi/GQjHOyApbNAt73y+FMZdRJEZr2brL 8YzdEEz3cQvVGEvf3+VKrGHSIexFoK3PmD5M3JhgU/YdMyoZfIXaQud5+fZ9Rac3xLD1 QPtetaCpw2pYa0x+yVbWRSSH8QluYdgU+RH2VIR7hXlUyT/PPHiQ/vxqjDqO6OhlWIKU vSrynwohRn46dUAdvriR1tiakrhMU1KOy9Nx/5J3G3/0awh2Y965U31DJLw/2hWhig/P 9xI9V3LRuSx673gHxPQBeRBK/yE0Ebzmt2pfgab3b4oUK+Mvaj3ctQGFG4fQAt+NpQk3 eudQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=puv0wVuinbvGk6m24vnUVnaprr7raVy2FnF9iWxEgDg=; b=p5Vru8nxY5LgpSlula7Gk9S1JFJIu6rbj/X/bQHAKt7aK5ZbCbClDsJDRut20/3UlE m6CXsXcZZIcqCypQXK59FW56zYQPr40dVVgjWzcM9+A5POYReAeYWwL0EdMQDOYOKWK8 nUV286f9HERIxAmxNnwAuwT/3xsOuEDSPuVfTYjuU0n1S+xeXtLg4Vk3laJ9q7a3AkwY Si7yHyW19FxDHVt/hrR6mzEUx4SiPbfKw1O4Go9J2P4N5b5khYtQ0ETxUV712ONGm/tb hlx7MBmwQggN8Sg7wku6UZgoYTsUZh8hZWF6cILl5NeWqIG+npFhQndx2WURZCMH5oJz aEzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="fy5pI89/"; 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=pass (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 d189-20020a6368c6000000b0041c2c6ad5fesi4874131pgc.376.2022.08.02.02.12.51; Tue, 02 Aug 2022 02:13:05 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b="fy5pI89/"; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235894AbiHBIrq (ORCPT + 99 others); Tue, 2 Aug 2022 04:47:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235400AbiHBIro (ORCPT ); Tue, 2 Aug 2022 04:47:44 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 748884AD68; Tue, 2 Aug 2022 01:47:42 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id p5so16693768edi.12; Tue, 02 Aug 2022 01:47:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=puv0wVuinbvGk6m24vnUVnaprr7raVy2FnF9iWxEgDg=; b=fy5pI89/qCZ86uVbKjW1FbiRmxM4/rk48gHhb5LLNd4ecu1hOXK11Bu6Tqe56E8SCc L+dn3ij2RF2voqhgeBbzUbxLQg7JN163YvlnaVDWvbcWnPQdF1TWTlyT8PXCuqH00Lvm DrdI20Ny5s59MM5bja2VRJh7aCgXmoyjGp+yjUW1oGqUKfrLt/+d9v2zzWabwi1ahTcD v2KEFubO/bSqP+pSSdA8l+JL2juWuynwaDJ9hLm9s73id+pzr7uz+4bfEykNpFdRY+Di ARlOTr78VjUnYKOIsRrPOKKS8ciEY6GOh/Tg08sXeeh6BoVRjGlUJcA8w38BG6PDjgKV LVIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=puv0wVuinbvGk6m24vnUVnaprr7raVy2FnF9iWxEgDg=; b=WALBNPzd9Y/Of8T1l8uI9X/SI1skbkH/DJy3AqtdkcCCU7MVPwCa5eDfxocM9fNb6v w7flqbzL8NSCQOxOCUOGFXSJHW4pykAe6d1G4OlVGOxrEW774FkF5ZjOtDst/IXlmFLf 7GqHP3swgYiupcFcJbzngeRvF0JRS/9Gi/+V+cdmCFoGRt2KSCFMpy9KuzwhgfqWR7eN Ylr6U9ID6n5qUl/VA1HCidHbhrrb20IZ+da3jJqmERhcwRMLlsw43VpZrS9G4MdvMVqO pGLLyEAvK9VJqpA0EQENfJMGmGLub066oEMBUSvcEuFoy8k06/0SdfTc72mSgSRWkutG tWNA== X-Gm-Message-State: AJIora/aiYnoWCNbF/AJXY3bX4U53raq+tXCfZ6DTAHeueaSuKQzo4kh W7b3faLnDL4Gk38jM5DdPrLCvkGFOCJ8QAtUXmc= X-Received: by 2002:a05:6402:84a:b0:426:262d:967e with SMTP id b10-20020a056402084a00b00426262d967emr18807129edz.286.1659430060844; Tue, 02 Aug 2022 01:47:40 -0700 (PDT) MIME-Version: 1.0 References: <20220722040609.91703-1-colin.foster@in-advantage.com> <20220722040609.91703-10-colin.foster@in-advantage.com> In-Reply-To: From: Andy Shevchenko Date: Tue, 2 Aug 2022 10:47:04 +0200 Message-ID: Subject: Re: [PATCH v14 mfd 9/9] mfd: ocelot: add support for the vsc7512 chip via spi To: Colin Foster Cc: linux-arm Mailing List , "open list:GPIO SUBSYSTEM" , netdev , Linux Kernel Mailing List , devicetree , Terry Bowman , Vladimir Oltean , Wolfram Sang , Microchip Linux Driver Support , Steen Hegelund , Lars Povlsen , Linus Walleij , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Russell King , Heiner Kallweit , Andrew Lunn , Krzysztof Kozlowski , Rob Herring , Lee Jones , katie.morris@in-advantage.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 On Tue, Aug 2, 2022 at 4:17 AM Colin Foster wrote: ... > > I'm wondering if you can use in both cases > > spi_message_init_with_transfers(). > > > > +static int ocelot_spi_regmap_bus_read(void *context, const void *reg, size_t reg_size, > > > + void *val, size_t val_size) > > > +{ > > > + struct spi_transfer tx, padding, rx; > > struct spi_transfer xfers[3] = {0}; > struct spi_transfer *xfer_tok = xfers; unsigned int index; > > > + struct device *dev = context; > > > + struct ocelot_ddata *ddata; > > > + struct spi_device *spi; > > > + struct spi_message msg; > > > + > > > + ddata = dev_get_drvdata(dev); > > > + spi = to_spi_device(dev); > > > + > > > + spi_message_init(&msg); > > > + > > > + memset(&tx, 0, sizeof(tx)); > > > + > > > + tx.tx_buf = reg; > > > + tx.len = reg_size; index = 0; > xfer_tok->tx_buf = reg; > xfer_tok->len = reg_size; tok[index] = ...; index++; > xfer_tok++; > > > > + spi_message_add_tail(&tx, &msg); > > > + > > > + if (ddata->spi_padding_bytes) { > > > + memset(&padding, 0, sizeof(padding)); > > > + > > > + padding.len = ddata->spi_padding_bytes; > > > + padding.tx_buf = ddata->dummy_buf; > > > + padding.dummy_data = 1; > > xfer_tok->len > xfer_tok->tx_buf > xfer_tok->dummy_data tok[index] = ... > xfer_tok++; index++; > > > + spi_message_add_tail(&padding, &msg); > > > + } > > > + > > > + memset(&rx, 0, sizeof(rx)); > > > + rx.rx_buf = val; > > > + rx.len = val_size; > > xfer_tok->rx_buf > xfer_tok->len tok[index] = ... > xfer_tok++; index++; > > > + spi_message_add_tail(&rx, &msg); > > spi_message_init_with_transfers(&msg, xfers, xfer_tok - xfers); ..., index); > > I'm wondering if you can use in both cases > > spi_message_init_with_transfers(). > > I could see that implementation getting the response of "what the heck > were you thinking" or "that looks alright" and I honestly have no idea > which pool it will fall into. See above. I.o.w. use index based assignments. > > > + return spi_sync(spi, &msg); > > > +} -- With Best Regards, Andy Shevchenko