Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp338451img; Mon, 18 Mar 2019 04:26:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqwKdFB0Sl9isF0RE6nthVWVkM4JC9SzGoYxP7lebCnQrxjX9fheCiUAdVKP6/L3C6EgBGxJ X-Received: by 2002:a17:902:be09:: with SMTP id r9mr19486571pls.189.1552908412862; Mon, 18 Mar 2019 04:26:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552908412; cv=none; d=google.com; s=arc-20160816; b=cz18LnswkCADxgLz0qeN4+Yh5gfX4918IuQZ6Lz+VeKqBQ/YMK3lD982V80vrAz+W1 eUnVRxg3pAKA/fJUDbBbbzPkX3eiZ7mLf2tYsFOvDIZTi1S7SId0CTx1cw/4pLjnqJgM AxdB2SmuLdy6koPtaOa3iK9uyOKkMaQCqUt2SLe+5lGVrgGk/XzQJvQXdd5HBaJcLw7s jrtEpiG6NVJslYmFEyZSnc4EWLVlImvZGJpIyKQiV5+q/NaGigyLOKzw0shziCCe+BGx OmvHyty2xdwE/fcyjAqnYdALyPUFqPrzBoCRMShRPQ80oirZJJ87hxB+A6Sg07J+BtB1 MG+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=TyGMBFlErpLsOf4k9yTtkJgv8F1/bFI3nTXCOKjEKG4=; b=Ra0ZqXvafPAfyAnbUIigVqy5P6/182HhMhRM2quaVDopXVl98CllBIGfY9oGoQVvSc Ti8N8FHVXB2hApMc0KiIz7nkyNhFNiaVUjcn8GRKu+YNRp4xvgQU+9ddGxM1qLFQ6bQq nEDC/DqDp8pkFxOsHVy7qQCXe4u11nPMRtuSJvjQFklwAdGQOfMpmZlbthnBPl+M6jFN c1yAjGKgi6knPVXRBweCwQj+NtLOpCPTyY6ZGqSYcaC1suuu9/NnBDhmDka5SBskWJ5n O/ueXOOJCY1v66pLjp6gnc5EMor3bT7Dxt0ADcocgqIRTiH6zUUJ0Ev50NyVQCZ1mV/n gTqA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l2si9391342pfc.287.2019.03.18.04.26.37; Mon, 18 Mar 2019 04:26:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726813AbfCRLYe (ORCPT + 99 others); Mon, 18 Mar 2019 07:24:34 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:60366 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725973AbfCRLYe (ORCPT ); Mon, 18 Mar 2019 07:24:34 -0400 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id BD1AB805BC; Mon, 18 Mar 2019 12:24:24 +0100 (CET) Date: Mon, 18 Mar 2019 12:24:31 +0100 From: Pavel Machek To: Rasmus Villemoes Cc: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , Jacek Anaszewski , LKML , linux-leds@vger.kernel.org Subject: Re: [PATCH v2 2/6] leds: netdev trigger: factor out middle part of device_name_store Message-ID: <20190318112431.GB6101@amd> References: <20190313202615.22883-1-linux@rasmusvillemoes.dk> <20190314140619.3309-1-linux@rasmusvillemoes.dk> <20190314140619.3309-3-linux@rasmusvillemoes.dk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="mxv5cy4qt+RJ9ypb" Content-Disposition: inline In-Reply-To: <20190314140619.3309-3-linux@rasmusvillemoes.dk> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --mxv5cy4qt+RJ9ypb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > Take the part of device_name_store that puts the old device (if any), > copies the new device name, looks the name up etc. into a separate > helper function. This is preparation for using that helper from a > function that will initialize the led_netdev_data from a device tree > node. No functional change. >=20 > Signed-off-by: Rasmus Villemoes > --- > drivers/leds/trigger/ledtrig-netdev.c | 30 ++++++++++++++++----------- > 1 file changed, 18 insertions(+), 12 deletions(-) >=20 > diff --git a/drivers/leds/trigger/ledtrig-netdev.c b/drivers/leds/trigger= /ledtrig-netdev.c > index 8d476b92f58c..21605033e322 100644 > --- a/drivers/leds/trigger/ledtrig-netdev.c > +++ b/drivers/leds/trigger/ledtrig-netdev.c > @@ -104,19 +104,9 @@ static ssize_t device_name_show(struct device *dev, > return len; > } > =20 > -static ssize_t device_name_store(struct device *dev, > - struct device_attribute *attr, const char *buf, > - size_t size) > +static void netdev_trig_set_device(struct led_netdev_data *trigger_data, > + const char *buf, size_t size) > { > - struct led_netdev_data *trigger_data =3D led_trigger_get_drvdata(dev); > - > - if (size >=3D IFNAMSIZ) > - return -EINVAL; > - > - cancel_delayed_work_sync(&trigger_data->work); > - > - spin_lock_bh(&trigger_data->lock); > - > if (trigger_data->net_dev) { > dev_put(trigger_data->net_dev); > trigger_data->net_dev =3D NULL; I'd expect the helper function to do the >=3D IFNAMSIZ checking... but not a huge deal. Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --mxv5cy4qt+RJ9ypb Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlyPf+8ACgkQMOfwapXb+vK4eQCcDRDfYmj+pYsMmb1KHtozXF7C Ls0An0UlaoZ8pJxEOJEuYPMperLCEhKx =c6Bd -----END PGP SIGNATURE----- --mxv5cy4qt+RJ9ypb--