From patchwork Mon Mar 29 20:10:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Annaliese McDermond X-Patchwork-Id: 411119 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=-14.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, PDS_BAD_THREAD_QP_64, SPF_HELO_NONE, SPF_PASS autolearn=unavailable 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 D0877C433C1 for ; Mon, 29 Mar 2021 20:11:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9975B617ED for ; Mon, 29 Mar 2021 20:11:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230337AbhC2UK4 (ORCPT ); Mon, 29 Mar 2021 16:10:56 -0400 Received: from a27-81.smtp-out.us-west-2.amazonses.com ([54.240.27.81]:55039 "EHLO a27-81.smtp-out.us-west-2.amazonses.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230395AbhC2UKu (ORCPT ); Mon, 29 Mar 2021 16:10:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=zzmz6pik4loqlrvo6grmnyszsx3fszus; d=nh6z.net; t=1617048649; h=Subject:From:To:Cc:Date:Mime-Version:Content-Type:Content-Transfer-Encoding:References:Message-Id; bh=K7KIbWMyfNkSCg4+/gHzQaPHfkkMmVADENdA1HNdl1I=; b=R0Dvtv5p5WU/1fwv4JbgF5bZdz31q72q+gwFZseQzBrHTRny+vjmDgZIe1Kr9jz/ CXySZBy5fyc8jyMawNyb//gIk1TDEb2g+eMDhRX4suE9i3IXJI6pbEeNcUnVoB9z+tn aJyXgn8DQztL+/A/d37OafXezfh/eD7NMrG3qjx0= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=7v7vs6w47njt4pimodk5mmttbegzsi6n; d=amazonses.com; t=1617048649; h=Subject:From:To:Cc:Date:Mime-Version:Content-Type:Content-Transfer-Encoding:References:Message-Id:Feedback-ID; bh=K7KIbWMyfNkSCg4+/gHzQaPHfkkMmVADENdA1HNdl1I=; b=L9yEBe+VAxejLLUEFDZE+4qcdfnGVQEmhK+JDF+ESm1YTsTGqmUbuCp5dy6NXtnS aP5P25MPFGatIo9vEYR5XXymZHizLosZOtbYCh1PLNpXbqmJiIGE6TEV73Uvd9PVXqC jneIPzuulK0SsOXjLd7Slx0UW5oXTZnV9PsTzBis= Subject: [PATCH v2] sc16is7xx: Defer probe if device read fails From: =?utf-8?q?Annaliese_McDermond?= To: =?utf-8?q?linux-serial=40vger=2Ekernel=2Eorg?= , =?utf-8?q?gregkh=40linuxfoundation=2E?= =?utf-8?q?org?= Cc: =?utf-8?q?Annaliese_McDermond?= , =?utf-8?q?jirislaby=40kernel=2Eorg?= , =?utf-8?q?team=40nwdigitalradio=2Ecom?= , =?utf-8?q?stable=40vger=2Ekernel=2Eorg?= Date: Mon, 29 Mar 2021 20:10:49 +0000 Mime-Version: 1.0 References: <20210329200848.409660-1-nh6z@nh6z.net> X-Mailer: Amazon WorkMail Thread-Index: AQHXJNebtcpZwxGpQ4q0FBV1tWCzFg== Thread-Topic: [PATCH v2] sc16is7xx: Defer probe if device read fails X-Original-Mailer: git-send-email 2.27.0 X-Wm-Sent-Timestamp: 1617048648 Message-ID: <010101787f9c3fd8-c1815c00-2d6b-4c85-a96a-a13e68597fda-000000@us-west-2.amazonses.com> X-SES-Outgoing: 2021.03.29-54.240.27.81 Feedback-ID: 1.us-west-2.An468LAV0jCjQDrDLvlZjeAthld7qrhZr+vow8irkvU=:AmazonSES Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org A test was added to the probe function to ensure the device was actually connected and working before successfully completing a probe. If the device was actually there, but the I2C bus was not ready yet for whatever reason, the probe fails permanently. Change the probe so that we defer the probe on a regmap read failure so that we try the probe again when the dependent drivers are potentially loaded. This should not affect the case where the device truly isn't present because the probe will never successfully complete. Fixes: 2aa916e67db3 ("sc16is7xx: Read the LSR register for basic device presence check") Cc: stable@vger.kernel.org Signed-off-by: Annaliese McDermond --- drivers/tty/serial/sc16is7xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.27.0 diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index f86ec2d2635b..9adb8362578c 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -1196,7 +1196,7 @@ static int sc16is7xx_probe(struct device *dev, ret = regmap_read(regmap, SC16IS7XX_LSR_REG << SC16IS7XX_REG_SHIFT, &val); if (ret < 0) - return ret; + return -EPROBE_DEFER; /* Alloc port structure */ s = devm_kzalloc(dev, struct_size(s, p, devtype->nr_uart), GFP_KERNEL);