Subject: [PATCH 0/2] ata: pata_ep93xx: dt convert preparation fixes

Sending some fixes in prior to "ep93xx device tree conversion" series,
as per Sergey request:

- simple replacement s/-ENXIO/-ENOMEM/ as it suits better.
- second is s/ep93xx_chip_revision()/soc_device_match(), so i can drop
ep93xx_chip_revision() entirely in later series.

Signed-off-by: Nikita Shubin <[email protected]>
---
Nikita Shubin (2):
ata: pata_ep93xx: fix error return code in probe
ata: pata_ep93xx: use soc_device_match for UDMA modes

drivers/ata/pata_ep93xx.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
---
base-commit: 89bf6209cad66214d3774dac86b6bbf2aec6a30d
change-id: 20230823-ep93xx_pata_fixes-56e6678cd6f1

Best regards,
--
Nikita Shubin <[email protected]>



Subject: [PATCH 2/2] ata: pata_ep93xx: use soc_device_match for UDMA modes

From: Nikita Shubin <[email protected]>

Replace ep93xx_chip_revision() with soc_device_match(), so
ep93xx_chip_revision() can be safetly dropped from exported functions.

Signed-off-by: Nikita Shubin <[email protected]>
---
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 <linux/ata.h>
#include <linux/libata.h>
#include <linux/platform_device.h>
+#include <linux/sys_soc.h>
#include <linux/delay.h>
#include <linux/dmaengine.h>
#include <linux/ktime.h>
@@ -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;
}

--
2.39.2


2023-08-23 17:05:36

by Sergey Shtylyov

[permalink] [raw]
Subject: Re: [PATCH 2/2] ata: pata_ep93xx: use soc_device_match for UDMA modes

On 8/23/23 12:47 PM, Nikita Shubin via B4 Relay wrote:

> From: Nikita Shubin <[email protected]>
>
> Replace ep93xx_chip_revision() with soc_device_match(), so
> ep93xx_chip_revision() can be safetly dropped from exported functions.
>
> Signed-off-by: Nikita Shubin <[email protected]>

Reviewed-by: Sergey Shtylyov <[email protected]>

[...]

MBR, Sergey