Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp2077962imd; Sun, 4 Nov 2018 16:40:48 -0800 (PST) X-Google-Smtp-Source: AJdET5cKwd7GIVUQVq7MNJyazOVXEZZe5Dq3sD77mfcfhJIZ72WWAc/AXuFKos5VfAET2tLEFcLk X-Received: by 2002:a17:902:b789:: with SMTP id e9-v6mr236017pls.338.1541378448927; Sun, 04 Nov 2018 16:40:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541378448; cv=none; d=google.com; s=arc-20160816; b=qadqrvwp4iRZW0CdHMpJCKSaOhGm+CuEWelrJJNPhd1/Apn9zBJR/HaskN5RzgeGVH 22GLcD84x45d2GG4WI3MkeQZo/unBpIUIifAyZ3u8dMiwDn4aZ0sRW9pt8sPs0zNs28Q KDjGhLWrZZ6nbqxGalavb/pi/mlRQhN3uI0I/l//kb8V3+rfcmclNemFKWYtqPTn0gJ3 WnItJLh6lWOGOG/Kk/nxNPltYk9JAZvqMmHJHafaN5a360K65v6Qz+HnPogcQDtJAY4k HylHGbg5B/u/b0G4B+OGHBQKsU9B8fP7V/RTeKXur6U8eCaLOpba92hTfTnM9KU6EuXb Gbsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=SrDHne1YBY9V9yLr4xiPZWWJXC6QI8j42WSVlKG0WQI=; b=ltI70WrxucX5B66212BPXnL97ij8ekZYmaP8/UFig8Im8cU8RTarprtBhRrZkQ6IJo 1laABOULdiTVYLqbffEYoCU63/RITG6hLwsqs+EMB/mZtI6UrX3Orb7M2xcrM3ywel+V alfUFGLmPqwUpRnc6pbjj4dpxVRlrIu/xtSDEHfVPRIz/RObz1gq1aGV95VdEplINak5 neA30NpsU8dKapqoZmswVh3FjaEMyXD7DWbpTy6OtiW2+Wo73PGXqyJUN+Itpddp2llK mGhUYt7hBRSbwZnq1lOW1d57CoWf+wPy+FkrC6Rw33+g0shwVfqXCxArVJlkJb7lmCmi qoug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MKFbS39y; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y5-v6si32695263pgo.310.2018.11.04.16.40.34; Sun, 04 Nov 2018 16:40:48 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=MKFbS39y; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732031AbeKEB6I (ORCPT + 99 others); Sun, 4 Nov 2018 20:58:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:37934 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729311AbeKEB6H (ORCPT ); Sun, 4 Nov 2018 20:58:07 -0500 Received: from archlinux (cpc91196-cmbg18-2-0-cust659.5-4.cable.virginm.net [81.96.234.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3ADFB2082D; Sun, 4 Nov 2018 16:42:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541349754; bh=/Rr/9BDAf4/EUShQJw9say9D0Aa4l00tFbSCi18LtZM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=MKFbS39yahfm5/YjCD2kOofY4W4ol9pJOsKx65lCEVGbO1w/eojmizxVFi4ff1uYR DKTo7ogyjfFMSJJMfqsRbToK9wDTX4Q9tY1gCH3uGurYZ0CyZ8xZxpA/BA1C4rwnpj dAfwIpV+KZZI8wo2ezCdwZIFHPSSlZTVryafsc3M= Date: Sun, 4 Nov 2018 16:42:29 +0000 From: Jonathan Cameron To: Matheus Tavares Cc: Lars-Peter Clausen , Michael Hennerich , Hartmut Knaack , Peter Meerwald-Stadler , Greg Kroah-Hartman , linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, kernel-usp@googlegroups.com Subject: Re: [PATCH v3 4/6] staging:iio:ad2s90: Move device registration to the end of probe Message-ID: <20181104164229.128d2f17@archlinux> In-Reply-To: <20181103224948.31014-5-matheus.bernardino@usp.br> References: <20181103224948.31014-1-matheus.bernardino@usp.br> <20181103224948.31014-5-matheus.bernardino@usp.br> X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 3 Nov 2018 19:49:46 -0300 Matheus Tavares wrote: > Previously, devm_iio_device_register was being called before the > spi_setup call and the spi_device's max_speed_hz and mode assignments. > This could lead to a race condition since the driver was still being > set up after it was already made ready to use. To fix it, this patch > moves the device registration to the end of ad2s90_probe. > > Signed-off-by: Matheus Tavares Applied. This is definitely looking more like a 'modern' IIO driver. All sorts of less than sensible things like this used to be done when all of us were new to drivers. Thanks, Jonathan > --- > drivers/staging/iio/resolver/ad2s90.c | 6 +----- > 1 file changed, 1 insertion(+), 5 deletions(-) > > diff --git a/drivers/staging/iio/resolver/ad2s90.c b/drivers/staging/iio/resolver/ad2s90.c > index 54ad85bd9dc6..8f79cccf4814 100644 > --- a/drivers/staging/iio/resolver/ad2s90.c > +++ b/drivers/staging/iio/resolver/ad2s90.c > @@ -79,10 +79,6 @@ static int ad2s90_probe(struct spi_device *spi) > indio_dev->num_channels = 1; > indio_dev->name = spi_get_device_id(spi)->name; > > - ret = devm_iio_device_register(indio_dev->dev.parent, indio_dev); > - if (ret) > - return ret; > - > /* need 600ns between CS and the first falling edge of SCLK */ > spi->max_speed_hz = 830000; > spi->mode = SPI_MODE_3; > @@ -93,7 +89,7 @@ static int ad2s90_probe(struct spi_device *spi) > return ret; > } > > - return 0; > + return devm_iio_device_register(indio_dev->dev.parent, indio_dev); > } > > static const struct spi_device_id ad2s90_id[] = {