From patchwork Sun Dec 24 21:36:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 758153 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 E18F2F510 for ; Sun, 24 Dec 2023 21:36:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="YrIno9MJ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1703453809; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=B7lO1uaz/ZRe5FDaz+Rmivlfd0oloIIxNKefGrRzMRc=; b=YrIno9MJYD3hsI593qevEAZkKuGJbgo47DLO03VaiHxhwJlpPHnWXzMgzTR1EW3Ct4pVE4 F6oD7WZu1CfJHN/OHjl9swpnzN5qxPcTDZR0dplU7hTXtxyjyMCGXhlpf/ZZd7JRP+OG2D vJPGwW3Huj1KJ3YTqNSsVRsd1fTK/TY= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-357-hxyS3GeNPqe4x_PnT2y3rw-1; Sun, 24 Dec 2023 16:36:45 -0500 X-MC-Unique: hxyS3GeNPqe4x_PnT2y3rw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (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) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9AD2A3869144; Sun, 24 Dec 2023 21:36:44 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.192.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id E2D3D2026D66; Sun, 24 Dec 2023 21:36:42 +0000 (UTC) From: Hans de Goede To: =?utf-8?q?Pali_Roh=C3=A1r?= , Jean Delvare , Andi Shyti , Eric Piel Cc: Hans de Goede , Paul Menzel , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Andy Shevchenko , Dell.Client.Kernel@dell.com, Marius Hoch , Kai Heng Feng , Wolfram Sang , platform-driver-x86@vger.kernel.org, linux-i2c@vger.kernel.org Subject: [PATCH 2/6] platform/x86: dell-smo8800: Change probe() ordering a bit Date: Sun, 24 Dec 2023 22:36:18 +0100 Message-ID: <20231224213629.395741-3-hdegoede@redhat.com> In-Reply-To: <20231224213629.395741-1-hdegoede@redhat.com> References: <20231224213629.395741-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 Retrieve the IRQ number from the platform_device a bit earlier and only call platform_set_drvdata() on successful probe (the drvdata is only used from the remove() callback). This is a preparation patch for moving the lis3lv02d i2c_client instantiation from the i2c-i801 driver to dell-smo8800. Signed-off-by: Hans de Goede --- drivers/platform/x86/dell/dell-smo8800.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/platform/x86/dell/dell-smo8800.c b/drivers/platform/x86/dell/dell-smo8800.c index 4d5f778fb599..86f898a857e1 100644 --- a/drivers/platform/x86/dell/dell-smo8800.c +++ b/drivers/platform/x86/dell/dell-smo8800.c @@ -125,19 +125,17 @@ static int smo8800_probe(struct platform_device *device) init_waitqueue_head(&smo8800->misc_wait); + err = platform_get_irq(device, 0); + if (err < 0) + return err; + smo8800->irq = err; + err = misc_register(&smo8800->miscdev); if (err) { dev_err(&device->dev, "failed to register misc dev: %d\n", err); return err; } - platform_set_drvdata(device, smo8800); - - err = platform_get_irq(device, 0); - if (err < 0) - goto error; - smo8800->irq = err; - err = request_threaded_irq(smo8800->irq, smo8800_interrupt_quick, smo8800_interrupt_thread, IRQF_TRIGGER_RISING | IRQF_ONESHOT, @@ -151,6 +149,7 @@ static int smo8800_probe(struct platform_device *device) dev_dbg(&device->dev, "device /dev/freefall registered with IRQ %d\n", smo8800->irq); + platform_set_drvdata(device, smo8800); return 0; error: