Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp16737970rwd; Mon, 26 Jun 2023 14:32:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4UMnJmBxs0bKf8MJgGogx8c0Rh3OOejHbdN+ifETG5JCByKAmix3dG8lhKRyvSSRNcqlzG X-Received: by 2002:a05:6a00:cc5:b0:654:ab4:305 with SMTP id b5-20020a056a000cc500b006540ab40305mr38180991pfv.2.1687815156420; Mon, 26 Jun 2023 14:32:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687815156; cv=pass; d=google.com; s=arc-20160816; b=i/ODE6e+fTJCgCcF5W+wqxXdQlWm43gQzLIFA++EllfNhLJNdZQ62JVbMSSVj1lUCB JKs1Wa6M2e5YGxptB4gxuhSypBg3sTaeFQ3FElzQNN2uTgmYC4lMoQJLk0GAEKei+QoO uO/7ji8ALSwYiCs5VPUYyHT3Rr7bl0O/4fDT3dtTaEOiY0FlAoFarNY6GYxY4fyNeOqk g4OxMtVuuh+cs7nEIsw1IR4Eo9qDzv2Z+aI9gReXmD+ouDTqI9JSkZcGCApvkJLYuFQI AU48NWkLixgK/grTET42Mh5aKF7H9Qe7Fo6qBXRVT55RU1+gw0N7i0PEJGhA6xK4xyX0 gGSA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=R0JZCt41Q31bNOEwMoxjG3zo6wpEHess263s+hM3YAE=; fh=OWSfhJzchsPjkxROirfbmlOGQFHGm/wer3ur0V6zcZc=; b=CkAi7WVbC8rs8ViB1K68djgrTeP7nIa79mYt5k6obLly0289BGG9hpzRg82zjMOKoc AtACTQXrjUOWSidsoEK2nBln/uV90HjkEChnS/wKh3LBh6RxE6P+P4Zva/KPW50UbCIw 3ceV5wOWW6fNlad5Hfxnky8+PRanSnn53GuAw+ezhbnzcyJDVJawYn5Yzqbf9svw2Olv x5RIL6a7A2ZJVzcibS5949FTSys4U6fI5eLYRG3Lhl4Lk84foN/Lkkga8qrTRIcq2awU eRB2xWaXxRLfUD9XVsBIGhNlkslOMnpDWQTPGfXiVa5y3mBszrlcC+8bnuOoV8gUf302 +7lg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@NETORG5796793.onmicrosoft.com header.s=selector1-NETORG5796793-onmicrosoft-com header.b=bL1hX7Jz; arc=pass (i=1 spf=pass spfdomain=labundy.com dkim=pass dkdomain=labundy.com dmarc=pass fromdomain=labundy.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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o11-20020a635d4b000000b0055745f8d6b1si5485940pgm.383.2023.06.26.14.32.24; Mon, 26 Jun 2023 14:32:36 -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=@NETORG5796793.onmicrosoft.com header.s=selector1-NETORG5796793-onmicrosoft-com header.b=bL1hX7Jz; arc=pass (i=1 spf=pass spfdomain=labundy.com dkim=pass dkdomain=labundy.com dmarc=pass fromdomain=labundy.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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230110AbjFZVRh (ORCPT + 99 others); Mon, 26 Jun 2023 17:17:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229808AbjFZVRe (ORCPT ); Mon, 26 Jun 2023 17:17:34 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DF7CA0; Mon, 26 Jun 2023 14:17:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eWCmEqkLySVp6OgYEQwpepbd1ah/jQZttrTDoCMlDEW+KBPmXYQ4n1K/HH4yWfHistup1yivGUOGMHQbJDFI30rYaQs6PurBY9wUZwNKA0/AbGKRWAEDuBuUrC1PHriwe73PixYcrUCjLG4jopFVfFVMrcLCslx5DfsSFMP3N31aUQZsJZqFPjgGXOQqrhyCOlduU32w9QNiRiGAfEdkL97Z7OnnTrU5bDnYASfkuuXRidqp9r5f389PopqOUB36y1pWnuEU1F0m7oNcgTJjJEZH1D3B2kuXIhgxI7kt4CfPh8obBsob9Ic8Jzz9QF84wWOwMv4iROQ/tPwNJVOlqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=R0JZCt41Q31bNOEwMoxjG3zo6wpEHess263s+hM3YAE=; b=YQMtTaM++n7nfu4EtHy4LS0Bvn0MOpSvCMQ3pZicmfRe5d1P+3EoADRLNVGNuPCbLAwepbkzjB4ugg0bW3IxnnP0rkPp760a6MP3Cp3//fiZEZhNXLVOeO4CjxR5Tp0vGlavVBf0mwSnw2aRUgqKxHNjpOeecCjIg7j3IATJSgXtlYodHyoSmXC8Me4Rd9k2CCEHfIgyo/g3fsU5nmRN+bFTVPaEjNn4uceIVpJvzJXBE14GSJ2qAijo40C/hE+zok+OB2YkYlL//Mc5ReSl7CKqJ5myvur8bMnXue7lQJUy6kpIcCJcF7tlMg0TrZeYkOulv9D39pFcTf/YTmXM9Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=labundy.com; dmarc=pass action=none header.from=labundy.com; dkim=pass header.d=labundy.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NETORG5796793.onmicrosoft.com; s=selector1-NETORG5796793-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R0JZCt41Q31bNOEwMoxjG3zo6wpEHess263s+hM3YAE=; b=bL1hX7Jzr0Kj4saP+bHTipIcG75N+BekzDgS6JmXwoPORPKsXfRTq56m82iCXLU9h7d4tzx8bYpB2I1HvCvYD6PVqHYQaHATUR8jL7SWpRqMs7E8VpNw8IKcExnKLsDZ22SYHZdu5u/950j9S7ScHRNJJBod0MRNJyKlmpaM16g= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=labundy.com; Received: from SN4PR0801MB3774.namprd08.prod.outlook.com (2603:10b6:803:43::21) by CO1PR08MB6546.namprd08.prod.outlook.com (2603:10b6:303:9f::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.26; Mon, 26 Jun 2023 21:17:30 +0000 Received: from SN4PR0801MB3774.namprd08.prod.outlook.com ([fe80::b94e:6032:56d4:35b2]) by SN4PR0801MB3774.namprd08.prod.outlook.com ([fe80::b94e:6032:56d4:35b2%6]) with mapi id 15.20.6521.024; Mon, 26 Jun 2023 21:17:30 +0000 Date: Mon, 26 Jun 2023 16:17:26 -0500 From: Jeff LaBundy To: Neil Armstrong Cc: Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bastien Nocera , Hans de Goede , Henrik Rydberg , linux-input@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 4/4] input: touchscreen: add SPI support for Goodix Berlin Touchscreen IC Message-ID: References: <20230606-topic-goodix-berlin-upstream-initial-v3-0-f0577cead709@linaro.org> <20230606-topic-goodix-berlin-upstream-initial-v3-4-f0577cead709@linaro.org> <94e80a49-11ae-e5b0-7eea-6ed4ec6d2ac8@linaro.org> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <94e80a49-11ae-e5b0-7eea-6ed4ec6d2ac8@linaro.org> X-ClientProxiedBy: DM6PR13CA0003.namprd13.prod.outlook.com (2603:10b6:5:bc::16) To SN4PR0801MB3774.namprd08.prod.outlook.com (2603:10b6:803:43::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN4PR0801MB3774:EE_|CO1PR08MB6546:EE_ X-MS-Office365-Filtering-Correlation-Id: 41f6b462-3ca6-4342-0722-08db768abfc5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FZTcPmGdx8uZib4aZ1Y6uHjDM/tY5Qnqn262KaBqh3p2jkVRYU34DJcUj1B0NtzSkKx78L8ymvoZGIsr6dG+g82aAoXFoyjqAt5o4GOCbi2HT8B6eEDnZZ0UyjKmmdQOK6PjfxRDOyff1ibGdiMitH0BM59WbrhPR27v8gV9dEIiggJDzzQO+C04AuD9qseTRsJzwGsUvwAClkh4D5++seEl2dpG718PFyOu3MmQDUqtzIVaoRoT6jG0aiemKPykRuW0EDFwZkiEXqn2xjRcaXegTLHP0a8Nmfby6azdpJL1ypzHmDUZsEoA92sxXSR9ktvORf+ty8CsYhRehYKLQODFCtjDmVWKVmR+GAY3iOsh1mi6o7y/aedr4kz8471d2OKfzKWa0tlKZ52Swe2pcwERbFT2alrfqu/UTlWG+AUCP2aZkSTWL0EEKik7fZJ63++/aUGaoDj9OpMDmpnUcg/dHjQ5++LuBFBC11jw2uXn+Y+ef78eIgUyyXzgNKnyc4SqJgcNOtQSy0DJ/Tkxon4nESr+5NkrJJYkH/77b1fq/DhISXM7yHgRgVVxHYUl X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN4PR0801MB3774.namprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(7916004)(39830400003)(396003)(346002)(136003)(366004)(376002)(451199021)(53546011)(6486002)(6666004)(54906003)(26005)(9686003)(6506007)(6512007)(478600001)(2906002)(186003)(5660300002)(33716001)(7416002)(6916009)(4326008)(316002)(38100700002)(66946007)(8676002)(41300700001)(66556008)(86362001)(8936002)(66476007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?gMKPqyr5t4JRuCfJctqsrwELDJ5TO5yd7j/UtSZ6APfdkGJctTHjhzFECPgC?= =?us-ascii?Q?5GKykYHy0T5aQzYgQsCpSo7iECGj5C5YrWQG4zNcWwtyJW7PyuzJrugBTspv?= =?us-ascii?Q?100PI5XQWl8rK0SurPQtvyRp1CQP+AciX8vigXmvwqga927ILk25rv49N+hj?= =?us-ascii?Q?/eOZuRHGorVt0X4MD6FTPtyuimxICuwsSHZDSMhOhMCamSxZ9RbHChCR81Lh?= =?us-ascii?Q?+8Epjf++Pz0QM4b3VJYfd2+qjilD/Ne4JUdagrJokoCHflSThjpoKsNNueto?= =?us-ascii?Q?u96mPkKmidnnBIexAYXFVjkAWL7f4AqOu7u4YgDXRiz9f2uGM7doW6cHO1kS?= =?us-ascii?Q?3ikDeLt0Te8DfFyxLXrdqovsLNpyn6vjXwUwkvyiUOa+L2+cw0YGIpkomlrP?= =?us-ascii?Q?oYUz379SVKFUtzJ6SKOaaDQrnLy/evoelGbgZCTdgyLhJea4hkt92SuRG/QX?= =?us-ascii?Q?m/ab+rNWwxj6EAihmw6lzdtAgSflWkuykPvTl2j+QnLSSCV54Vl7L86q6kGu?= =?us-ascii?Q?QcVEqsQkkdltvp7mzwCPBiKWJuLP59PT2fT7x37OxY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/AX2C+KpYt8fmwzoH9+hXoneYpH9dMFNaQ?= =?us-ascii?Q?ttPhzHjrFdvqdk769EHF+Z0YTX+9iHX88tcgRJYQhOW+FZvJLEgsaQqDWktt?= =?us-ascii?Q?VCeY5sGgl179yfy1h7acUtgmJmJ9AiJFoShfvMOi?= X-OriginatorOrg: labundy.com X-MS-Exchange-CrossTenant-Network-Message-Id: 41f6b462-3ca6-4342-0722-08db768abfc5 X-MS-Exchange-CrossTenant-AuthSource: SN4PR0801MB3774.namprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2023 21:17:30.0424 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 00b69d09-acab-4585-aca7-8fb7c6323e6f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Nq6NLQJViiPL4Mo6y/qaEVjCRHLzJnnnCHHCXdueIlUAX3Y9urwlUDXlfBalScSsX6h9aGdocCZB98/Ko1XXgg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR08MB6546 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 Hi Neil, On Mon, Jun 26, 2023 at 03:20:35PM +0200, Neil Armstrong wrote: > Hi, > > On 26/06/2023 15:01, Jeff LaBundy wrote: > > Hi Neil, > > > > On Mon, Jun 26, 2023 at 09:02:16AM +0200, Neil Armstrong wrote: > > > > [...] > > > > > > > +static int goodix_berlin_spi_probe(struct spi_device *spi) > > > > > +{ > > > > > + struct regmap_config *regmap_config; > > > > > + struct regmap *regmap; > > > > > + size_t max_size; > > > > > + int error = 0; > > > > > + > > > > > + regmap_config = devm_kmemdup(&spi->dev, &goodix_berlin_spi_regmap_conf, > > > > > + sizeof(*regmap_config), GFP_KERNEL); > > > > > + if (!regmap_config) > > > > > + return -ENOMEM; > > > > > > > > Is there any reason we cannot simply pass goodix_berlin_spi_regmap_conf to > > > > devm_regmap_init() below? Why to duplicate and pass the copy? > > > > > > > > For reference, BMP280 in IIO is a similar example of a device with regmap > > > > sitting atop a bespoke SPI protocol; it does not seem to take this extra > > > > step. > > > > > > The goodix_berlin_spi_regmap_conf copy is modified after with the correct > > > max raw read/write size, and I'm not a fan of modifying a global structure > > > that could be use for multiple probes, I can make a copy in a stack variable > > > if it feels simpler. > > > > Ah, that makes sense; in that case, the existing implementation seems fine > > to me. No changes necessary. > > > > Correct me if I'm wrong, but the stack variable method wouldn't work since > > that memory is gone after goodix_berlin_spi_probe() returns. > > The config is only needed for the devm_regmap_init() duration, so keeping > the memory allocated for the whole lifetime of the device seems useless. I revisted the regmap code, and you are indeed correct. I agree with your suggestion. > > Neil > > > > > Kind regards, > > Jeff LaBundy > Kind regards, Jeff LaBundy