From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 611E2C4741F for ; Wed, 30 Sep 2020 19:48:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2477D20709 for ; Wed, 30 Sep 2020 19:48:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729742AbgI3TsD (ORCPT ); Wed, 30 Sep 2020 15:48:03 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:49294 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725799AbgI3TsD (ORCPT ); Wed, 30 Sep 2020 15:48:03 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id B36711C0B76; Wed, 30 Sep 2020 21:48:00 +0200 (CEST) Date: Wed, 30 Sep 2020 21:48:00 +0200 From: Pavel Machek To: Luka Kovacic Cc: linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-leds@vger.kernel.org, lee.jones@linaro.org, dmurphy@ti.com, robh+dt@kernel.org, jdelvare@suse.com, linux@roeck-us.net, andrew@lunn.ch, jason@lakedaemon.net, gregory.clement@bootlin.com, marek.behun@nic.cz, luka.perkov@sartura.hr, robert.marko@sartura.hr Subject: Re: [PATCH v3 4/7] drivers: leds: Add the iEi WT61P803 PUZZLE LED driver Message-ID: <20200930194759.GA24378@amd> References: <20200930014058.44460-1-luka.kovacic@sartura.hr> <20200930014058.44460-5-luka.kovacic@sartura.hr> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="PNTmBPCT7hxwcZjr" Content-Disposition: inline In-Reply-To: <20200930014058.44460-5-luka.kovacic@sartura.hr> User-Agent: Mutt/1.5.23 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org --PNTmBPCT7hxwcZjr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > +static int iei_wt61p803_puzzle_led_brightness_set_blocking(struct led_cl= assdev *cdev, > + enum led_brightness brightness) > +{ > + struct iei_wt61p803_puzzle_led *priv =3D cdev_to_iei_wt61p803_puzzle_le= d(cdev); > + unsigned char *resp_buf =3D priv->response_buffer; > + unsigned char led_power_cmd[5] =3D { > + IEI_WT61P803_PUZZLE_CMD_HEADER_START, > + IEI_WT61P803_PUZZLE_CMD_LED, > + IEI_WT61P803_PUZZLE_CMD_LED_POWER, > + (char)IEI_LED_OFF > + }; > + size_t reply_size; > + > + mutex_lock(&priv->lock); > + if (brightness =3D=3D LED_OFF) { > + led_power_cmd[3] =3D (char)IEI_LED_OFF; > + priv->led_power_state =3D LED_OFF; > + } else { > + led_power_cmd[3] =3D (char)IEI_LED_ON; > + priv->led_power_state =3D LED_ON; > + } > + mutex_unlock(&priv->lock); > + > + return iei_wt61p803_puzzle_write_command(priv->mcu, led_power_cmd, > + sizeof(led_power_cmd), resp_buf, &reply_size); > +} Is the mutex needed? If so, should it include the iei_wt61p803_puzzle_write_command()? Does iei_wt61p803_puzzle_write_command() have internal locking to prevent two messages from being mingled? Best regards, Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --PNTmBPCT7hxwcZjr Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAl904O8ACgkQMOfwapXb+vJOSQCguV6B9JSD9i7nKfA/RwRRVT4C 7acAn2vNyJo369bnI3lFJ7V+FVzDajV0 =hxl0 -----END PGP SIGNATURE----- --PNTmBPCT7hxwcZjr-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C194C4727C for ; Wed, 30 Sep 2020 19:49:45 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B3D7C206F4 for ; Wed, 30 Sep 2020 19:49:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mOIBQ52G" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B3D7C206F4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ucw.cz Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=2IFY1QuJpftjhd14aiLWxkDVZj9rte+pohPjRQAvf8U=; b=mOIBQ52GwTjdHy4GKvxrDXtVa +vkVin95D2GjbJTjsQAS+5sPgOn2VanpJakqmCksmr5FlvQaM1OuKTIAFEQtIv+WN4aL5Q3F3fNub NTD3TQTOkjXclj9F0TvEzRrvb7j12yNsRIYm0a/A6TI3U33aMxMoFrywaebMKMZUN9SJJc9mvMR52 k7IS+xEtzKzyosIGLyeKDsPGNH0C5sz73FyxR6cZMqlF+vJqkVMnXSXxTRyNsiXxGsTLKUMFET/gd pbs1v6cBXiCh5PpMboBn2a3vmvwsEEX99NYsdmcfDBHjuEaIWM6uH/yQmFR62cJFpq13imTXn4BeU TGb7UYmWg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kNi59-0004GI-Tn; Wed, 30 Sep 2020 19:48:07 +0000 Received: from jabberwock.ucw.cz ([46.255.230.98]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kNi57-0004FP-FK for linux-arm-kernel@lists.infradead.org; Wed, 30 Sep 2020 19:48:06 +0000 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id B36711C0B76; Wed, 30 Sep 2020 21:48:00 +0200 (CEST) Date: Wed, 30 Sep 2020 21:48:00 +0200 From: Pavel Machek To: Luka Kovacic Subject: Re: [PATCH v3 4/7] drivers: leds: Add the iEi WT61P803 PUZZLE LED driver Message-ID: <20200930194759.GA24378@amd> References: <20200930014058.44460-1-luka.kovacic@sartura.hr> <20200930014058.44460-5-luka.kovacic@sartura.hr> MIME-Version: 1.0 In-Reply-To: <20200930014058.44460-5-luka.kovacic@sartura.hr> User-Agent: Mutt/1.5.23 (2014-03-12) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200930_154805_627085_EE8C0A3D X-CRM114-Status: GOOD ( 14.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-hwmon@vger.kernel.org, andrew@lunn.ch, jdelvare@suse.com, luka.perkov@sartura.hr, jason@lakedaemon.net, gregory.clement@bootlin.com, linux@roeck-us.net, linux-kernel@vger.kernel.org, marek.behun@nic.cz, robh+dt@kernel.org, linux-arm-kernel@lists.infradead.org, robert.marko@sartura.hr, lee.jones@linaro.org, linux-leds@vger.kernel.org, dmurphy@ti.com Content-Type: multipart/mixed; boundary="===============7031941951100728644==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============7031941951100728644== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="PNTmBPCT7hxwcZjr" Content-Disposition: inline --PNTmBPCT7hxwcZjr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > +static int iei_wt61p803_puzzle_led_brightness_set_blocking(struct led_cl= assdev *cdev, > + enum led_brightness brightness) > +{ > + struct iei_wt61p803_puzzle_led *priv =3D cdev_to_iei_wt61p803_puzzle_le= d(cdev); > + unsigned char *resp_buf =3D priv->response_buffer; > + unsigned char led_power_cmd[5] =3D { > + IEI_WT61P803_PUZZLE_CMD_HEADER_START, > + IEI_WT61P803_PUZZLE_CMD_LED, > + IEI_WT61P803_PUZZLE_CMD_LED_POWER, > + (char)IEI_LED_OFF > + }; > + size_t reply_size; > + > + mutex_lock(&priv->lock); > + if (brightness =3D=3D LED_OFF) { > + led_power_cmd[3] =3D (char)IEI_LED_OFF; > + priv->led_power_state =3D LED_OFF; > + } else { > + led_power_cmd[3] =3D (char)IEI_LED_ON; > + priv->led_power_state =3D LED_ON; > + } > + mutex_unlock(&priv->lock); > + > + return iei_wt61p803_puzzle_write_command(priv->mcu, led_power_cmd, > + sizeof(led_power_cmd), resp_buf, &reply_size); > +} Is the mutex needed? If so, should it include the iei_wt61p803_puzzle_write_command()? Does iei_wt61p803_puzzle_write_command() have internal locking to prevent two messages from being mingled? Best regards, Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --PNTmBPCT7hxwcZjr Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAl904O8ACgkQMOfwapXb+vJOSQCguV6B9JSD9i7nKfA/RwRRVT4C 7acAn2vNyJo369bnI3lFJ7V+FVzDajV0 =hxl0 -----END PGP SIGNATURE----- --PNTmBPCT7hxwcZjr-- --===============7031941951100728644== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============7031941951100728644==--