Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp162800rwi; Sun, 30 Oct 2022 22:36:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM66UE/ZnLFAe8/+A3FE2TpnQ8E3OPkYhHp0re4Itq4bV21/aaMMFn2p+C48G+tLX1BKMv1u X-Received: by 2002:a63:444f:0:b0:464:3985:3c92 with SMTP id t15-20020a63444f000000b0046439853c92mr11284908pgk.412.1667194578883; Sun, 30 Oct 2022 22:36:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667194578; cv=none; d=google.com; s=arc-20160816; b=NDYgO2xUyTTMqu+Zv7KPP5zVXflQqjE8/a5wlIL5jJHnJIICICk4XHAR/LKG0JFHhl bFxJwMwUhmHsHsIurUthVvt2Bntw09zKkp3wHVLm2e8aCiImF1LAwUWtNofIdJMJRqNz cjIwqBdYRnAUhxxHctgtexKdZtOit7rUFFu2eqYZf0H1703ds+OmCmJdkcidkWfj4tiE MVQSr3gAmoJk+n0PhylQfRSIRxNupWAb34KkXbZzqw/8B9WG1PC05aK6mAweJYyORWFm TrMHPiLHGfJOWFqvtZPEDfTZdsgtbWIOIkb+rMPPy/TiQPHsG5dh0o+AQi3wwoAlpqPD CpOQ== 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:from:date:dkim-signature; bh=99ozrpM6sapv+ZVzQ9VDBqva9vPLvyZO871ABPRbhbs=; b=LuAhi3DUeele6YHI6XZaROOcGWgPosIXiruopcyN3Iha3vF+uI/Af/QywqMu1QRVCM pJpFNAju4zxjD+jycBc9GfMW6/LmkJKeviGq8Z6FX/scs9qEuLCrhUYzYq5PS3c5//NO TrtNEFYeW/GgI/8avLYRLk43dkUL/3qZl/m4M061nBpZEO4PnJJ93bzMs4KT0nnQKZTt K4Cq3cJS52iFsOI7fUvNw8VbgkMJVUtbrndseLif3B14FMM7kFbkeOs5SgWVcaUOIfRz 6sz3V603+gq9TGADqpEeyaeoW1PrmhKnUM/Wy20AFvu8wGR94Re7QeE1cs9nZe9p1SdB FzKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GczfpQaA; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id me8-20020a17090b17c800b0020aeaa98ed4si9056748pjb.93.2022.10.30.22.36.04; Sun, 30 Oct 2022 22:36:18 -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=@kernel.org header.s=k20201202 header.b=GczfpQaA; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229695AbiJaE4J (ORCPT + 99 others); Mon, 31 Oct 2022 00:56:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbiJaE4G (ORCPT ); Mon, 31 Oct 2022 00:56:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D470ADC8 for ; Sun, 30 Oct 2022 21:56:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5579360F37 for ; Mon, 31 Oct 2022 04:56:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C06C0C433D6; Mon, 31 Oct 2022 04:55:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667192160; bh=GAUz+juERAciVv8IqD0c3C4zKt3CzZRqEa0LqI1Dsmk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GczfpQaAZ/Ge7rswNpoIirFbptr3bnjKqCWCvOwEKfgZAV6bKSqzsWLKoHPyJIbXH hDU6D+oIBTq84Ec4Ws9CCeEkry/P933AK6r8ZJ/OEFpQze/oQjvyzIidF//ML1d0it lGzl0ahaAU+vXs3vDe1rgV5wEsrZUecWumfKYNu8uBrXr9hMBQ0bap8bCZNBDae9EB vGfu9knXTWN8gVUq0OIlROUWoqb3ocuJnk1LG0jGS8jl/7UCU/wFRqNPfUuA4K/9T+ 13Bfi2KwK6LW4TsEca1i1ksz9/bHwrmjbmxWFIpkVcks8+ge00FZNMp/AFqrzaU/Nr cNWbt/IKpuQZg== Date: Mon, 31 Oct 2022 12:55:57 +0800 From: Tzung-Bi Shih To: Brian Norris Cc: Benson Leung , Guenter Roeck , chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/5] platform/chrome: cros_ec_lpc: Move mec_init/destroy to device probe/remove Message-ID: References: <20221028141411.1.I0728421299079b104710c202d5d7095b2674fd8c@changeid> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221028141411.1.I0728421299079b104710c202d5d7095b2674fd8c@changeid> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,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 Fri, Oct 28, 2022 at 02:14:45PM -0700, Brian Norris wrote: > Disregarding the weird global state hiding in this cros_ec_lpc_mec_*() > stuff, it belongs in device probe/remove. We shouldn't assume we can > access hardware resources when the device isn't attached to the driver. It's also weird that cros_ec_lpc_mec_destroy() destroies a statically allocated mutex[1]. How about let's remove it? [1]: https://elixir.bootlin.com/linux/v6.0/source/drivers/platform/chrome/cros_ec_lpc_mec.c#L152 > @@ -586,9 +591,6 @@ static int __init cros_ec_lpc_init(void) > return -ENODEV; > } > > - cros_ec_lpc_mec_init(EC_HOST_CMD_REGION0, > - EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SIZE); > - > /* Register the driver */ > ret = platform_driver_register(&cros_ec_lpc_driver); > if (ret) { There are 2 more cros_ec_lpc_mec_destroy()s need to be removed [2][3] though. [2]: https://elixir.bootlin.com/linux/v6.0/source/drivers/platform/chrome/cros_ec_lpc.c#L596 [3]: https://elixir.bootlin.com/linux/v6.0/source/drivers/platform/chrome/cros_ec_lpc.c#L606