Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp408672pxb; Thu, 21 Oct 2021 01:50:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBS20jj/Dhgw5ZrlHsuTROVkYMVacp6xUDOdvV+27QqBSAlVI/3tlqkEeXjR5HM8qMW1oq X-Received: by 2002:a05:6a00:2410:b0:409:5fbd:cb40 with SMTP id z16-20020a056a00241000b004095fbdcb40mr4638241pfh.8.1634806243118; Thu, 21 Oct 2021 01:50:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634806243; cv=none; d=google.com; s=arc-20160816; b=jsFNLglT9LxXeaw94RNuYgPjZUf6qVhHl5GGf3+DYUjy0BtRt6GPEI7wreaT/L85uU Ka9J1dhpUP2f2R0dev6jfFQ1Q2lGFxsF79C8UF7CY6P3L/LD/JLkDK3QEmmCsVwnlVE/ od2vvP8AGwqGQANE8meeVthnqOlHzTDrFYwk628xSpz3noPP6RLyyRbOWTDPI+Upqs3M uWI1hO12JG7maRE6NKhuYBa28aNQ9GMa4Rgk8a9/jry6ITSdgsrEVG5f/7fR2o7TGHsF xhFgGZ3wJZgwdBOhXr7VHhwYqSmgs9lNgszMuVlVgThlgx8Qyd++7AmvkRgozd88Pozo Uf9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=N0t3tI0x09UykVrDlWJfBqg4gVODEbxL8QBgQkCO018=; b=kSS19QhXEbYQOikVh8rV/M/jmFdTEE1uuezFW1oorufllQUN/80+ygHwtcvETw9zxl M3pJ4ov1ojFrjMlyzEbNu+A99mR5R5LPtA+CAZNXB0do3KP07dWWL5wIDnp2ASZbf8pI ik9ND405I89+kuJZjzxMIg28WUmvfgA08YZOR2MNuLueFTZG+ZxsCfxIsM5oM/jDlU6J SjMJ63e5ekhd9z9ho2yKSPFP6KbO2Lr8gJPJxuaP8XWxIwstpJqibycbQkzF7gDKGnDl HX42eCSAyO9yA1qiFsQpQD5jRx7PoU9QqQYYx6CgL0+C+k98WiAE/RhI3uY4bUP9Wz0G 2DYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@metafoo.de header.s=default2002 header.b=YsdIss7D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=metafoo.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lb1si1794183pjb.2.2021.10.21.01.50.28; Thu, 21 Oct 2021 01:50:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@metafoo.de header.s=default2002 header.b=YsdIss7D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=metafoo.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231493AbhJUIux (ORCPT + 99 others); Thu, 21 Oct 2021 04:50:53 -0400 Received: from www381.your-server.de ([78.46.137.84]:59826 "EHLO www381.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231287AbhJUIuw (ORCPT ); Thu, 21 Oct 2021 04:50:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=metafoo.de; s=default2002; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID; bh=N0t3tI0x09UykVrDlWJfBqg4gVODEbxL8QBgQkCO018=; b=YsdIss7DHX2bmPBjv3VK9gu8Cj gnJioT2zEhf5RlFQwu+5LoTlYosq4n6K3cG+kXJGkCoaDQHVJ5SiocNA+fL3SBfPTKYB6502ySraE BMm6ymM+Afr51ItLWQpFQNIjv6gItMrbZsgElaVJ2Tei9FFGo+6hrrGCe74fe2Ckd/3zUhbqM6iTQ Ae1YDcH/4ouH2dFQzGzMQGSq4dnZ7rZ/tmBJKZhZrBgN39XsKUQcI0iiHUdS8Nw/OxvtVa3sEtFBU ksHenlR7qZ+Fce4ZQ+Soy3tPEChyKwpjeFduk2FSu6ynRqIrjDm5y4PsQgu1N6YV9NB6DBHX4LIOe C1lwKa2w==; Received: from sslproxy06.your-server.de ([78.46.172.3]) by www381.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1mdTkX-0000wi-6O; Thu, 21 Oct 2021 10:48:33 +0200 Received: from [82.135.83.71] (helo=[192.168.178.20]) by sslproxy06.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mdTkX-000RM3-2v; Thu, 21 Oct 2021 10:48:33 +0200 Subject: Re: [PATCH] iio: adc: ina2xx: Make use of the helper macro kthread_run() To: Cai Huoqing Cc: Jonathan Cameron , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org References: <20211021083917.2024-1-caihuoqing@baidu.com> From: Lars-Peter Clausen Message-ID: <6699a823-b7b4-6453-aec0-95058b26c27f@metafoo.de> Date: Thu, 21 Oct 2021 10:48:32 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20211021083917.2024-1-caihuoqing@baidu.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Authenticated-Sender: lars@metafoo.de X-Virus-Scanned: Clear (ClamAV 0.103.3/26328/Wed Oct 20 10:18:39 2021) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/21/21 10:39 AM, Cai Huoqing wrote: > Repalce kthread_create/wake_up_process() with kthread_run() > to simplify the code. > > Signed-off-by: Cai Huoqing Hi, Thanks for the patch, this looks good! Reviewed-by: Lars-Peter Clausen > --- > [...] > if (IS_ERR(task)) > return PTR_ERR(task); > > get_task_struct(task); This is unrelated to this patch. But I wonder do we really need the get_task_struct()? The driver calls put_task_struct() right after kthread_stop(). kthread_create()/kthread_run() and kthread_stop() already do reference counting of the task, so we are essentially just double reference counting. Maybe you can send another patch to cleanup the get_task_struct()/put_task_struct() in this driver. > - wake_up_process(task); > chip->task = task; > > return 0;