pcd: move the identify buffer into pcd_identify

[ Upstream commit 7d8b72aadd ]

No need to pass it through a bunch of functions.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Stable-dep-of: 1a721de848 ("block: don't add or resize partition on the disk with GENHD_FL_NO_PART")
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Christoph Hellwig
2021-09-27 15:01:03 -07:00
committed by Greg Kroah-Hartman
parent 242bbe2188
commit 7607bc7fe6

View File

@@ -630,10 +630,11 @@ static int pcd_drive_status(struct cdrom_device_info *cdi, int slot_nr)
return CDS_DISC_OK; return CDS_DISC_OK;
} }
static int pcd_identify(struct pcd_unit *cd, char *id) static int pcd_identify(struct pcd_unit *cd)
{ {
int k, s;
char id_cmd[12] = { 0x12, 0, 0, 0, 36, 0, 0, 0, 0, 0, 0, 0 }; char id_cmd[12] = { 0x12, 0, 0, 0, 36, 0, 0, 0, 0, 0, 0, 0 };
char id[18];
int k, s;
pcd_bufblk = -1; pcd_bufblk = -1;
@@ -664,15 +665,15 @@ static int pcd_identify(struct pcd_unit *cd, char *id)
* returns 0, with id set if drive is detected * returns 0, with id set if drive is detected
* -1, if drive detection failed * -1, if drive detection failed
*/ */
static int pcd_probe(struct pcd_unit *cd, int ms, char *id) static int pcd_probe(struct pcd_unit *cd, int ms)
{ {
if (ms == -1) { if (ms == -1) {
for (cd->drive = 0; cd->drive <= 1; cd->drive++) for (cd->drive = 0; cd->drive <= 1; cd->drive++)
if (!pcd_reset(cd) && !pcd_identify(cd, id)) if (!pcd_reset(cd) && !pcd_identify(cd))
return 0; return 0;
} else { } else {
cd->drive = ms; cd->drive = ms;
if (!pcd_reset(cd) && !pcd_identify(cd, id)) if (!pcd_reset(cd) && !pcd_identify(cd))
return 0; return 0;
} }
return -1; return -1;
@@ -709,7 +710,6 @@ static void pcd_probe_capabilities(void)
static int pcd_detect(void) static int pcd_detect(void)
{ {
char id[18];
int k, unit; int k, unit;
struct pcd_unit *cd; struct pcd_unit *cd;
@@ -727,7 +727,7 @@ static int pcd_detect(void)
cd = pcd; cd = pcd;
if (cd->disk && pi_init(cd->pi, 1, -1, -1, -1, -1, -1, if (cd->disk && pi_init(cd->pi, 1, -1, -1, -1, -1, -1,
pcd_buffer, PI_PCD, verbose, cd->name)) { pcd_buffer, PI_PCD, verbose, cd->name)) {
if (!pcd_probe(cd, -1, id)) { if (!pcd_probe(cd, -1)) {
cd->present = 1; cd->present = 1;
k++; k++;
} else } else
@@ -744,7 +744,7 @@ static int pcd_detect(void)
conf[D_UNI], conf[D_PRO], conf[D_DLY], conf[D_UNI], conf[D_PRO], conf[D_DLY],
pcd_buffer, PI_PCD, verbose, cd->name)) pcd_buffer, PI_PCD, verbose, cd->name))
continue; continue;
if (!pcd_probe(cd, conf[D_SLV], id)) { if (!pcd_probe(cd, conf[D_SLV])) {
cd->present = 1; cd->present = 1;
k++; k++;
} else } else