Exemple #1
0
static int scsi_add_single_device(uint host, uint channel, uint id, uint lun)
{
    struct Scsi_Host *shost;
    int error = -ENXIO;

    shost = scsi_host_lookup(host);
    if (IS_ERR(shost))
        return PTR_ERR(shost);

    if (shost->transportt->user_scan)
        error = shost->transportt->user_scan(shost, channel, id, lun);
    else
        error = scsi_scan_host_selected(shost, channel, id, lun, 1);
    scsi_host_put(shost);
    return error;
}
Exemple #2
0
static int scsi_scan(struct Scsi_Host *shost, const char *str)
{
	char s1[15], s2[15], s3[15], junk;
	unsigned int channel, id, lun;
	int res;

	res = sscanf(str, "%10s %10s %10s %c", s1, s2, s3, &junk);
	if (res != 3)
		return -EINVAL;
	if (check_set(&channel, s1))
		return -EINVAL;
	if (check_set(&id, s2))
		return -EINVAL;
	if (check_set(&lun, s3))
		return -EINVAL;
	if (shost->transportt->user_scan)
		res = shost->transportt->user_scan(shost, channel, id, lun);
	else
		res = scsi_scan_host_selected(shost, channel, id, lun, 1);
	return res;
}