From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from 008.lax.mailroute.net (008.lax.mailroute.net [199.89.1.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A681EA2D for ; Thu, 6 Feb 2025 20:31:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=199.89.1.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738873890; cv=none; b=bFhQ/Z5jrvyUJodKAXZp5hJAn7dpBTxe89MaUcdh0eNcN5V4bp2CGOKEJ8Md4jW5VxEkQJBuUmZmo2aIhio7JHvCZQnhHbrLLv6cU2AQwIl3mwoaG86MKj4nwsXUS7n/yn3rRa4pIQBzHctFUFVmGGOmAB/4UcuVmwemFf4AKrI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738873890; c=relaxed/simple; bh=LTmSabbW/Y7VhJo+4qOETOm9CZX+diKLl77Z+Tt7p74=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=aYSzlRTSgw5HnIUkrmCwqtDTgA04sP8IOFjg9Aduv9sIp5/YhBUWjOseq8ySq868faBhgpnXey91oMlPm+Bh9fSMx6A5Kd3bIZEDP2EN9Z93+cjYwyvWWj+5Hm3o6BLqEacVu7jH+NAtE83XU3YEoRM+nzVNwsQa3B/gJYiCnR0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org; spf=pass smtp.mailfrom=acm.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b=YQauap5v; arc=none smtp.client-ip=199.89.1.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=acm.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b="YQauap5v" Received: from localhost (localhost [127.0.0.1]) by 008.lax.mailroute.net (Postfix) with ESMTP id 4YppfR5j1Hz6CmQyc; Thu, 6 Feb 2025 20:31:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=acm.org; h= content-transfer-encoding:content-type:content-type:in-reply-to :from:from:content-language:references:subject:subject :user-agent:mime-version:date:date:message-id:received:received; s=mr01; t=1738873880; x=1741465881; bh=2NJpuP8QAvrvl+PVL24frdpu VZt5EE9YT2b5o/wg7Sc=; b=YQauap5vt91p/64wa2xD++T/ZIQ2JWQO8wxX1/RH Xar37Pyvo92+OPWWeZ+xi1WOLRBHtV/o65PEcuTNSTtJhoelhJGqiaPtWgTRUMS4 pzdDUvF+W7dBvu8Iczfu+BO9oGWPB+QYNrAW49iKHVKbA+09SWwrTFUeNbWCK7Sb 4W/ktd5YuQuXCHFkGP1TvI5ywA0tdtuIbXEcRb0h4u/wbo/rCUB251x649M3BKc/ alyVBChUDX8ea7FdZ6ocro8HJeCSx0ThYkXkNa+eUNbpHcy6ra1WUWuOITFRXX6G 6fGY/AQhisdqp6w6+oLB0o1DknrAat3T/0tZOaVi0FKTLw== X-Virus-Scanned: by MailRoute Received: from 008.lax.mailroute.net ([127.0.0.1]) by localhost (008.lax [127.0.0.1]) (mroute_mailscanner, port 10029) with LMTP id SA9dIvRNaZcF; Thu, 6 Feb 2025 20:31:20 +0000 (UTC) Received: from [100.66.154.22] (unknown [104.135.204.82]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bvanassche@acm.org) by 008.lax.mailroute.net (Postfix) with ESMTPSA id 4YppfF2X6tz6CmQyZ; Thu, 6 Feb 2025 20:31:16 +0000 (UTC) Message-ID: <373d62da-810f-492c-af2f-53b32cc90b33@acm.org> Date: Thu, 6 Feb 2025 12:31:14 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/2] drm: zynqmp_dp: Use scope-based mutex helpers To: Sean Anderson , Laurent Pinchart , Tomi Valkeinen , "open list:DRM DRIVERS FOR XILINX" Cc: Thomas Zimmermann , "moderated list:ARM/ZYNQ ARCHITECTURE" , open list , David Airlie , Dan Carpenter , Michal Simek , Maxime Ripard , Simona Vetter , Maarten Lankhorst References: <20250206194117.1496245-1-sean.anderson@linux.dev> <20250206194117.1496245-3-sean.anderson@linux.dev> Content-Language: en-US From: Bart Van Assche In-Reply-To: <20250206194117.1496245-3-sean.anderson@linux.dev> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2/6/25 11:41 AM, Sean Anderson wrote: > static int zynqmp_dp_enhanced_set(void *data, u64 val) > { > struct zynqmp_dp *dp = data; > - int ret = 0; > > - mutex_lock(&dp->lock); > + guard(mutex)(&dp->lock); > dp->test.enhanced = val; > if (dp->test.active) > - ret = zynqmp_dp_test_setup(dp); > - mutex_unlock(&dp->lock); > + return zynqmp_dp_test_setup(dp); > > - return ret; > + return 0; > } Has it been considered to combine the two return statements into one with the ternary operator (?:)? > static int zynqmp_dp_downspread_set(void *data, u64 val) > { > struct zynqmp_dp *dp = data; > - int ret = 0; > > - mutex_lock(&dp->lock); > + guard(mutex)(&dp->lock); > dp->test.downspread = val; > if (dp->test.active) > - ret = zynqmp_dp_test_setup(dp); > - mutex_unlock(&dp->lock); > + return zynqmp_dp_test_setup(dp); > > - return ret; > + return 0; > } Same question here. > @@ -2053,7 +2039,8 @@ static ssize_t zynqmp_dp_custom_read(struct file *file, char __user *user_buf, > return ret; > > mutex_lock(&dp->lock); > - ret = simple_read_from_buffer(user_buf, count, ppos, &dp->test.custom, > + ret = simple_read_from_buffer(user_buf, count, ppos, > + &dp->test.custom, > sizeof(dp->test.custom)); This change has not been mentioned in the patch description and is not related to the other changes in this patch? > - return ret; > + dp->test.link_cnt = val; > + if (dp->test.active) > + return zynqmp_dp_test_setup(dp); > + > + return 0; > } Has it been considered to use the ternary operator here? Thanks, Bart.