Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1582225rda; Mon, 23 Oct 2023 18:09:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH4JNBegnzdmYG2U0F802137VPbK/GoGB8QbpgWOtgkH23d8xBItnsVeQo6QzrOXxMPiYh/ X-Received: by 2002:a54:4107:0:b0:3b2:e765:9beb with SMTP id l7-20020a544107000000b003b2e7659bebmr11212784oic.56.1698109758781; Mon, 23 Oct 2023 18:09:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698109758; cv=pass; d=google.com; s=arc-20160816; b=dxn6QOe+MWc4VnZ16PcHOXgeaDsz4g7RK11FStrZI0I38MJFLtUW9Up7C42XcKsBbp CeOL6pfE8iVt8J+qLiAwagSc/Epn48IRHpNYyIkVinF5H8C7FZ5yGM8qEsmdqqi4Mqzk xZtUd3yX8op3tPNiXoJ6DzUfTBoNNZPCEZOfSgNLJwABsMOQgQ8jDpVNEGycxsxqYv6p K2oNmQqcayBWxsljeIfo4TuZzBkKk5/u1d/w4hhbL54miZ30bgYOnYWixw5QFQDg9/TR c6dkijS6qbdhL+hhY8e7FbngSIMbnSdO1C4VELsTUeDZMqlBxU6DJiW+5ZBnlmPR6k1O 3qlQ== 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-transfer-encoding:content-disposition:references:message-id :subject:cc:to:from:date:dkim-signature; bh=dKbXxSgHRTAU6W0ruuwY/9/TrwxzZJ+8GrnUPdnY8FY=; fh=6uhO4ycEsEPHnFdfsnTbn0Xic+njTtcS9d9mki4X+DM=; b=oKrwYTEVtY574oaZDrLsSG/ycDSk0/UtaOqdAhG6y3IQvNyq77oDXqydVk9cJ7M/QI L6/ADu7cqBHDgyNP9Dteh/N0eFFUbwioUQ78VwfOxVR0FwEfpCTeguAVN1emeE3x5xi+ qj7Rv8NuB8HmykyW/htD6nI5oB9rt9caBeXJT12pa8nV3JxOsP94y68y/K5BNnPzQ/Gm /3Omck+WMuJxhu8B4LUyUkcuRY/YALwc6ZvCrs2ZMldCTaelhW040JBysN5KTSyh5OY+ q137e0O0XmsoWjKFCKj605WuXJHAbHb3WMn/aiKyDPzXkBTAoO3YcYDvFURVBIEyoRZq y0GQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@NETORG5796793.onmicrosoft.com header.s=selector1-NETORG5796793-onmicrosoft-com header.b=CDL41CFH; 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::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id bf20-20020a656d14000000b00582dcfe3b41si7371183pgb.374.2023.10.23.18.09.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 18:09:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@NETORG5796793.onmicrosoft.com header.s=selector1-NETORG5796793-onmicrosoft-com header.b=CDL41CFH; 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::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id D909280A6EDB; Mon, 23 Oct 2023 18:09:15 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231544AbjJXBJC (ORCPT + 99 others); Mon, 23 Oct 2023 21:09:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229510AbjJXBJB (ORCPT ); Mon, 23 Oct 2023 21:09:01 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2084.outbound.protection.outlook.com [40.107.220.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8D6BDE; Mon, 23 Oct 2023 18:08:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f0Vhw28NLaCgHA8ebsV5CFrc2MSDPeP7SJgVCz/4Fu8xOTaZxkYvR1UplkdKtsw8+FjeqisSOQETHzekQyshqq3SqhEwI4e3bEQys2RsW1e3pc7WSiQyzor6xWqUQGUZuwTyEc3IW2KPRfSFU8fp4qQxaonvb8uAxjr8WDcNW0+cw2i7Dpgg2PJEowZWFQsaU+as7bBO4+EdFMjdrY297YYixtMvafr5z6wIAx99O9ji3LwbGlVpnitg89q9mqxE+p4PYfmCHWiTlrgLafMpLiXnYWfpyg3816diBaNF7jBQ3otr0KTFw6RkU+9vxf0+gCNj3ZifMHvWFLe9Eynj9A== 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=dKbXxSgHRTAU6W0ruuwY/9/TrwxzZJ+8GrnUPdnY8FY=; b=ava4pPRPK1L68adVAYM6sLH84vlEpPov+djuPzDlCIQw9ED3stkI0e8KfE+9JMubyDtpfr4twzmBJExRY4p7L3gwaeoB/LpilwYv1UeVXbCwiMy4TT96rvtKlczb6dfrzLD5iuMtMbRgJfTSzVb/VVS7JVDg0Yw6DL6QlfreiTmk8Ov92HhFUtSjjLd2nqbzjskj2RbdrvQ6lRIV9qKdK8rUjdtKC1w6ySngO7kLC8AuG3HoIdJG2cfHBaqMO7ksIZTYza4X8gIxLmI+HsU2QmCn10hHu/xCgl8bH6VheLj3CxOGgoq2BtlR4YPVCvX9rLwKkZvotvG4BhjfgKs20A== 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=dKbXxSgHRTAU6W0ruuwY/9/TrwxzZJ+8GrnUPdnY8FY=; b=CDL41CFHu+SIIA2vF/8PT2WrqWlveJzIDFcTtvk5Y7/FfE/fDQYC0QnlRBqUd3HWBfv2raG0Va/7FUiAd7XXcZ99Ue49TtbQFyfVeCPPEU/hJLE/pCkglYMHc6V4hqcBCHqYnA8A3AtN/1Gzmwdcp/a3ssRiZ9cben2nYS3ecaA= 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 DS0PR08MB8656.namprd08.prod.outlook.com (2603:10b6:8:15d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.33; Tue, 24 Oct 2023 01:08:55 +0000 Received: from SN4PR0801MB3774.namprd08.prod.outlook.com ([fe80::e73c:270b:75f7:5302]) by SN4PR0801MB3774.namprd08.prod.outlook.com ([fe80::e73c:270b:75f7:5302%4]) with mapi id 15.20.6907.032; Tue, 24 Oct 2023 01:08:54 +0000 Date: Mon, 23 Oct 2023 20:08:48 -0500 From: Jeff LaBundy To: Lee Jones Cc: James Ogletree , James Ogletree , Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Fred Treven , Ben Bright , "linux-input@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v4 3/4] mfd: cs40l50: Add support for CS40L50 core driver Message-ID: References: <20231018175726.3879955-1-james.ogletree@opensource.cirrus.com> <20231018175726.3879955-4-james.ogletree@opensource.cirrus.com> <20231019162359.GF2424087@google.com> <20231023092046.GA8909@google.com> Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20231023092046.GA8909@google.com> X-ClientProxiedBy: DM6PR14CA0065.namprd14.prod.outlook.com (2603:10b6:5:18f::42) To SN4PR0801MB3774.namprd08.prod.outlook.com (2603:10b6:803:43::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN4PR0801MB3774:EE_|DS0PR08MB8656:EE_ X-MS-Office365-Filtering-Correlation-Id: 1ced57ab-bbe2-4a9e-bf77-08dbd42dcade X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OJcH1F67iX0qLoyNHQ5q8LHWkT+5BlZX6KWjw4w+6peIpqjEfwxkO+x4eF6xCwl7EzXV8BvWZAbq9GjKea+9tTPb8ZF8nVV07rbqLK/194eTDGLmvym6yNwoQDGVjWMnKJQCnnUTOL5c0bbeixaDkIgfmqA161AiILGhXIVYZxBWOSe6/3/+LsHKIAVhtelUisOY9XLz+h1g4OcDg/7nXp4Tvgv0WgsBwqbuJWu9EaKzvaLY2oDYuONE7JiwgPLa3gBLFAGlcmtdk3gzbTiwTurvPYdYqQQP8FWm/3337Fk1ndkBdYIHoXv6MLunK1SBAHotyWIB849tZLX+As/pYIfN5I/gdpX03sSX4mBtVXpD6OdCsJb8n9R1l8ipQkdycVHV+4Za/rtSOobuXtvGWKVEWDhMpjFyk+gy3QeCU4w1StVK8Bi9kD6RlmMr7DLYNRyELH+5zNhflBHfbXPDBGZIfmCiGnUJdq1MYi9CXpTv6CgsgH5phcQVLwuUQBC/PAkEW2uDGxv+uoZjO215UtwvUTwciEjg0yxM7/4RTyFfb2YQlUWFomqlOoJLdJBx3TaLOTbIHiDLfkZlNsuR4ZLSSwE9z5WkERB2zVEH+NY= 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:(13230031)(7916004)(346002)(366004)(396003)(136003)(39830400003)(376002)(230922051799003)(186009)(451199024)(1800799009)(64100799003)(41300700001)(2906002)(38100700002)(316002)(54906003)(66476007)(66946007)(66556008)(6916009)(6506007)(478600001)(6486002)(6666004)(6512007)(9686003)(83380400001)(5660300002)(86362001)(4326008)(8676002)(7416002)(8936002)(26005)(33716001)(67856001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?ZlA4Yng5bFdpaGFtcGd1Y1pOa3NDSllzYWJLR2pxYmhzN2tDSFgzK3kwMzhP?= =?utf-8?B?a1NSYWhVRkk2QzlvUS9rUlJrY25IWk9oVWhkWnVCT2J6UFJYTTZpcEtNMlU4?= =?utf-8?B?bERIZTVvYzExbC82Q1hjaG9oNk1HSlNpaUJPSDZWQUM2bXUvWjNzSjlZTEJZ?= =?utf-8?B?akRTcjIwLzl5QWR6dFZMVDJGL3ZKWnBKaHA3MUxhaHlycUVEM1pobkJKd0t4?= =?utf-8?B?ZGtOWUtQYTdycDhjMWFDdVJJTlZwcGdDMjNBWVRYMjJtRGhicStGYUFUSU9F?= =?utf-8?B?NU5VUmFrOWJwYVQwNjRYRG5hdHI3NEVzZUN5UXhrY3JMb0N6SXBsZXNIRHNk?= =?utf-8?B?WW9BRWIreDk1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exchange-CrossTenant-Network-Message-Id: 1ced57ab-bbe2-4a9e-bf77-08dbd42dcade X-MS-Exchange-CrossTenant-AuthSource: SN4PR0801MB3774.namprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2023 01:08:54.6841 (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: A8cY6VvpRJF4kzXl8y6kQUfPCxI7cxA4EUXXNpCmsHo7WrJ34GKwDAYXVRmkeoQHBI4plAgyXbyLc53nJW0qHA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR08MB8656 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 23 Oct 2023 18:09:16 -0700 (PDT) Hi Lee and James, On Mon, Oct 23, 2023 at 10:20:46AM +0100, Lee Jones wrote: [...] > > >> +static int cs40l50_handle_redc_est_done(struct cs40l50_private *cs40l50) > > >> +{ > > >> + int error, fractional, integer, stored; > > > > > > err or ret is traditional. > > > > We received feedback to change from “ret” to “error” in the input > > subsystem, and now the opposite in MFD. I have no problem adopting > > “err” here, but is it understood that styles will be mixed across > > components? FWIW, this is not an uncommon outcome for submissions that span multiple subsystems. > > That surprises me: > > % git grep "int .*error" | wc -l > 6152 > > vs > > % git grep "int .*err" | grep -v error | wc -l > 34753 > % git grep "int .*ret" | wc -l > 76584 Right, the history here is that this driver started its life in input, where submitters have historically been asked to use 'error' for return variables that return either zero or a negative error code. Since this driver is no longer in input, this can easily be changed. [...] > > > Should the last two drivers live in drivers/mailbox? > > > > Adopting the mailbox framework seems like an excessive amount > > of overhead for our requirements. > > MFD isn't a dumping a ground for miscellaneous functionality. > > MFD requests resources and registers devices. > > Mailbox functionality should live in drivers/mailbox. I think this is just a misnomer; the code uses the terms "mailbox" and "mbox" throughout because the relevant registers are named as such in the datasheet. Please correct me James, but I believe the datasheet uses this language because both the host and the part itself have write access, meaning the part may write a status code to the register after the host writes that same register. There is no relation to IPC or the mbox subsystem. That being said, some of the functions currently placed in this MFD, namely those related to haptic motor properties (e.g. f0 and ReDC), do seem more appropriate for the input/FF child device. My understanding is that those functions serve only momentary haptic click effects and not the I2S streaming case; please let me know if I have misunderstood. I understand that no customer would ever build the to-be-added codec driver _without_ the input driver, but the MFD must be generic enough to support this case. Would a codec-only implementation use f0 and ReDC estimation? If so, then these functions _do_ belong in the MFD, albeit with some comments to explain their nature. [...] > > >> +{ > > >> + struct device *dev = cs40l50->dev; > > >> + int error; > > >> + > > >> + mutex_init(&cs40l50->lock); > > > > > > Don't you need to destroy this in the error path? > > > > My understanding based on past feedback is that mutex_destroy() > > is an empty function unless mutex debugging is enabled, and there > > is no need cleanup the mutex explicitly. I will change this if you > > disagree with that feedback. > > It just seems odd to create something and not tear it down. mutex_init() is not creating anything; the mutex struct is allocated as part of the driver's private data, which is de-allocated as part of device managed resources being freed when the module is unloaded. mutex_destroy() is a NOP unless CONFIG_DEBUG_MUTEXES is set, and there are roughly 4x fewer instances of it than mutex_init() in mainline. I recommend not to add mutex_destroy() because it adds unnecessary tear-down paths and remove() callbacks that wouldn't otherwise have to exist. Kind regards, Jeff LaBundy