From patchwork Wed Aug 23 09:47:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita Shubin via B4 Relay X-Patchwork-Id: 1824620 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=Sn9hcYf2; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ide-owner@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by legolas.ozlabs.org (Postfix) with ESMTP id 4RW1fc23VPz1yg8 for ; Wed, 23 Aug 2023 19:50:16 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231666AbjHWJuM (ORCPT ); Wed, 23 Aug 2023 05:50:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236166AbjHWJtg (ORCPT ); Wed, 23 Aug 2023 05:49:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE54411F; Wed, 23 Aug 2023 02:47:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4BE9265E41; Wed, 23 Aug 2023 09:47:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 6D6EFC433C8; Wed, 23 Aug 2023 09:47:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692784058; bh=CUB+u6bVCnkeuFktM5zQ93AxsKZq6KM0HrW/RWf5h5E=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=Sn9hcYf2m+u8sS5L4KsABJsUeCIA2r4WDsh3+r3uYeRRxINaqcc47iSep2j6GsyG2 PSOEPSWWNP9slVJAtwTH7AsZ/Z9C26RC9ljN9le4XGE0VpmuJEikQNjiSFuCETgDRC ur0Ct08XF2gwW6i/NC3A2897dRibjHnAYzTlNSiA8Odt4lUineFl8gSrKe6HGsii1j xqIPhY01/lML8JDeCtYQEdXwRVvyF77u5W9ByYQJI6Pex/rlo22F10gBKaTzk/v3QG 6vlcceaGecuRZohcKahhnWdjSbnNeGqPhEwGgWSm2/TfcvUht8qfGq/jDMNa6PHlO5 +ppa7yUUnwiPg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43A2EEE49B4; Wed, 23 Aug 2023 09:47:38 +0000 (UTC) From: Nikita Shubin via B4 Relay Date: Wed, 23 Aug 2023 12:47:27 +0300 Subject: [PATCH 1/2] ata: pata_ep93xx: fix error return code in probe MIME-Version: 1.0 Message-Id: <20230823-ep93xx_pata_fixes-v1-1-d7e7229be148@maquefel.me> References: <20230823-ep93xx_pata_fixes-v1-0-d7e7229be148@maquefel.me> In-Reply-To: <20230823-ep93xx_pata_fixes-v1-0-d7e7229be148@maquefel.me> To: Sergey Shtylyov , Damien Le Moal Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org, Nikita Shubin X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1692784059; l=900; i=nikita.shubin@maquefel.me; s=20230718; h=from:subject:message-id; bh=jYEaemYd1aErVDz1ZLCTtX58S5YLSNWId6yDIFw7HVw=; =?utf-8?q?b=3DiV4woMczzqwW?= =?utf-8?q?fAyaeeBpmYNnvFmAVzLgmavJtQvOa677LWj7OjdgnBPGOjXOyvkq1IvHu2gJVkwf?= NhAV/ZimBI22z6M/kXCSrq4TsrBRgHlpdUKT5w+AmYCLfN+B2KFO X-Developer-Key: i=nikita.shubin@maquefel.me; a=ed25519; pk=vqf5YIUJ7BJv3EJFaNNxWZgGuMgDH6rwufTLflwU9ac= X-Endpoint-Received: by B4 Relay for nikita.shubin@maquefel.me/20230718 with auth_id=65 X-Original-From: Nikita Shubin Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org From: Nikita Shubin Return -ENOMEM from ep93xx_pata_probe() if devm_kzalloc() or ata_host_alloc() fails. Signed-off-by: Nikita Shubin Reviewed-by: Sergey Shtylyov --- drivers/ata/pata_ep93xx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ata/pata_ep93xx.c b/drivers/ata/pata_ep93xx.c index c6e043e05d43..4ce0f37c7a89 100644 --- a/drivers/ata/pata_ep93xx.c +++ b/drivers/ata/pata_ep93xx.c @@ -939,7 +939,7 @@ static int ep93xx_pata_probe(struct platform_device *pdev) drv_data = devm_kzalloc(&pdev->dev, sizeof(*drv_data), GFP_KERNEL); if (!drv_data) { - err = -ENXIO; + err = -ENOMEM; goto err_rel_gpio; } @@ -952,7 +952,7 @@ static int ep93xx_pata_probe(struct platform_device *pdev) /* allocate host */ host = ata_host_alloc(&pdev->dev, 1); if (!host) { - err = -ENXIO; + err = -ENOMEM; goto err_rel_dma; } From patchwork Wed Aug 23 09:47:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita Shubin via B4 Relay X-Patchwork-Id: 1824618 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=hbOwMTX3; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ide-owner@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by legolas.ozlabs.org (Postfix) with ESMTP id 4RW1fT6JSzz1yg8 for ; Wed, 23 Aug 2023 19:50:09 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235095AbjHWJuB (ORCPT ); Wed, 23 Aug 2023 05:50:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236163AbjHWJtd (ORCPT ); Wed, 23 Aug 2023 05:49:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B23E810B; Wed, 23 Aug 2023 02:47:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4B73062A5D; Wed, 23 Aug 2023 09:47:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 81AC4C433CB; Wed, 23 Aug 2023 09:47:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692784058; bh=BgJoy5WrNNunfZnzqn99cjCrMrRRSaZhBdRfquCyX+U=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=hbOwMTX30a6QoY4/iBxfF/gRUOFRxyy3ybKtYSzn9U2JsVO+o3De8I/TQ+ElEoBXU lbp148Kb9bFkQ9KlnLFfZqQvBuYAI04LAnwRnslTA9RMOQzVEcMjwEhsvzvoclXeZQ CPSmSRZOk5v9sW1h4ZTlqQVVZJiWNyYXbtvlSWiDMOZOh7suIORflgdIQAnZ9gm01p fITuV1gi2SzipF9d6AZqLIZ0NEtTVuMtEb5bUen2ql2Zdsb1K1A2HtmvKIOZlc4NsP Tjk+4EOZ5tzIkNnC+0x34EJmkmRtsuMiYr+KhpXivW9x2XhmFWgV3x9Wc7d9SQeEMG PIj1t95/5NoQg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5709CEE49B5; Wed, 23 Aug 2023 09:47:38 +0000 (UTC) From: Nikita Shubin via B4 Relay Date: Wed, 23 Aug 2023 12:47:28 +0300 Subject: [PATCH 2/2] ata: pata_ep93xx: use soc_device_match for UDMA modes MIME-Version: 1.0 Message-Id: <20230823-ep93xx_pata_fixes-v1-2-d7e7229be148@maquefel.me> References: <20230823-ep93xx_pata_fixes-v1-0-d7e7229be148@maquefel.me> In-Reply-To: <20230823-ep93xx_pata_fixes-v1-0-d7e7229be148@maquefel.me> To: Sergey Shtylyov , Damien Le Moal Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org, Nikita Shubin X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1692784059; l=1745; i=nikita.shubin@maquefel.me; s=20230718; h=from:subject:message-id; bh=S/mHeNOqmdky76OBBe9mnLniUEhK/mD6hu3snL8cYnQ=; =?utf-8?q?b=3DZh3hEy1066mg?= =?utf-8?q?5eGLVabyipHBoWgKlB/mlIUlnn3UXSC5kJzVHxfeCrDPtloT6CVJEy6typOP/Xr/?= dVZGid7DB4vtZGfpF9FlFskH0r6PPnwSJwFO0y+J3BDXN2HhVqMM X-Developer-Key: i=nikita.shubin@maquefel.me; a=ed25519; pk=vqf5YIUJ7BJv3EJFaNNxWZgGuMgDH6rwufTLflwU9ac= X-Endpoint-Received: by B4 Relay for nikita.shubin@maquefel.me/20230718 with auth_id=65 X-Original-From: Nikita Shubin Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org From: Nikita Shubin Replace ep93xx_chip_revision() with soc_device_match(), so ep93xx_chip_revision() can be safetly dropped from exported functions. Signed-off-by: Nikita Shubin Reviewed-by: Sergey Shtylyov --- drivers/ata/pata_ep93xx.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/ata/pata_ep93xx.c b/drivers/ata/pata_ep93xx.c index 4ce0f37c7a89..3f91b6cff353 100644 --- a/drivers/ata/pata_ep93xx.c +++ b/drivers/ata/pata_ep93xx.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -910,6 +911,12 @@ static struct ata_port_operations ep93xx_pata_port_ops = { .port_start = ep93xx_pata_port_start, }; +static const struct soc_device_attribute ep93xx_soc_table[] = { + { .revision = "E1", .data = (void *)ATA_UDMA3 }, + { .revision = "E2", .data = (void *)ATA_UDMA4 }, + { /* sentinel */ } +}; + static int ep93xx_pata_probe(struct platform_device *pdev) { struct ep93xx_pata_data *drv_data; @@ -976,12 +983,11 @@ static int ep93xx_pata_probe(struct platform_device *pdev) * so this driver supports only UDMA modes. */ if (drv_data->dma_rx_channel && drv_data->dma_tx_channel) { - int chip_rev = ep93xx_chip_revision(); + const struct soc_device_attribute *match; - if (chip_rev == EP93XX_CHIP_REV_E1) - ap->udma_mask = ATA_UDMA3; - else if (chip_rev == EP93XX_CHIP_REV_E2) - ap->udma_mask = ATA_UDMA4; + match = soc_device_match(ep93xx_soc_table); + if (match) + ap->udma_mask = (unsigned int) match->data; else ap->udma_mask = ATA_UDMA2; }