Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8447d9d5 authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz
Browse files

ide: add ide_device_add()



* Add ide_device_add() helper and convert host drivers to use it
  instead of open-coded variants.

* Make ide_pci_setup_ports() and do_ide_setup_pci_device()
  take 'u8 *idx' argument instead of 'ata_index_t *index'.

* Remove no longer needed ata_index_t.

* Unexport probe_hwif_init() and make it static.

* Unexport ide_proc_register_port().

There should be no functionality changes caused by this patch
(sgiioc4.c: ide_proc_register_port() requires hwif->present
 to be set and it won't be set if probe_hwif_init() fails).

Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent fd9bb539
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -500,6 +500,7 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec)
{
	ide_hwif_t *hwif;
	void __iomem *base;
	u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };

	base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0);
	if (!base)
@@ -523,9 +524,9 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec)

	state->hwif[0] = hwif;

	probe_hwif_init(hwif);
	idx[0] = hwif->index;

	ide_proc_register_port(hwif);
	ide_device_add(idx);

	return 0;
}
@@ -537,6 +538,7 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec)
	void __iomem *ioc_base, *easi_base;
	unsigned int sel = 0;
	int ret;
	u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };

	ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0);
	if (!ioc_base) {
@@ -608,11 +610,10 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec)
		icside_dma_init(mate);
	}

	probe_hwif_init(hwif);
	probe_hwif_init(mate);
	idx[0] = hwif->index;
	idx[1] = mate->index;

	ide_proc_register_port(hwif);
	ide_proc_register_port(mate);
	ide_device_add(idx);

	return 0;

+6 −2
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
	ide_hwif_t *hwif;
	void __iomem *base;
	int ret;
	u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };

	ret = ecard_request_resources(ec);
	if (ret)
@@ -74,8 +75,11 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
		hwif->hwif_data = base;
		hwif->gendev.parent = &ec->dev;
		hwif->noprobe = 0;
		probe_hwif_init(hwif);
		ide_proc_register_port(hwif);

		idx[0] = hwif->index;

		ide_device_add(idx);

		ecard_set_drvdata(ec, hwif);
		goto out;
	}
+20 −3
Original line number Diff line number Diff line
@@ -861,7 +861,7 @@ static void probe_hwif(ide_hwif_t *hwif)
static int hwif_init(ide_hwif_t *hwif);
static void hwif_register_devices(ide_hwif_t *hwif);

int probe_hwif_init(ide_hwif_t *hwif)
static int probe_hwif_init(ide_hwif_t *hwif)
{
	probe_hwif(hwif);

@@ -877,8 +877,6 @@ int probe_hwif_init(ide_hwif_t *hwif)
	return 0;
}

EXPORT_SYMBOL(probe_hwif_init);

#if MAX_HWIFS > 1
/*
 * save_match() is used to simplify logic in init_irq() below.
@@ -1410,3 +1408,22 @@ int ideprobe_init (void)
}

EXPORT_SYMBOL_GPL(ideprobe_init);

int ide_device_add(u8 idx[4])
{
	int i, rc = 0;

	for (i = 0; i < 4; i++) {
		if (idx[i] != 0xff)
			rc |= probe_hwif_init(&ide_hwifs[idx[i]]);
	}

	for (i = 0; i < 4; i++) {
		if (idx[i] != 0xff)
			ide_proc_register_port(&ide_hwifs[idx[i]]);
	}

	return rc;
}

EXPORT_SYMBOL_GPL(ide_device_add);
+0 −2
Original line number Diff line number Diff line
@@ -804,8 +804,6 @@ void ide_proc_register_port(ide_hwif_t *hwif)
	create_proc_ide_drives(hwif);
}

EXPORT_SYMBOL_GPL(ide_proc_register_port);

#ifdef CONFIG_BLK_DEV_IDEPCI
void ide_pci_create_host_proc(const char *name, get_info_t *get_info)
{
+4 −3
Original line number Diff line number Diff line
@@ -715,9 +715,10 @@ int ide_register_hw(hw_regs_t *hw, void (*fixup)(ide_hwif_t *),
	hwif->chipset = hw->chipset;
	hwif->gendev.parent = hw->dev;

	if (!initializing) {
		probe_hwif_init(hwif);
		ide_proc_register_port(hwif);
	if (initializing == 0) {
		u8 idx[4] = { index, 0xff, 0xff, 0xff };

		ide_device_add(idx);
	}

	if (hwifp)
Loading