Merge tag 'libata-5.8-2020-06-19' of git://git.kernel.dk/linux-block
Pull libata fixes from Jens Axboe: "A few minor changes that should go into this release" * tag 'libata-5.8-2020-06-19' of git://git.kernel.dk/linux-block: libata: Use per port sync for detach ata/libata: Fix usage of page address by page_address in ata_scsi_mode_select_xlat function sata_rcar: handle pm_runtime_get_sync failure cases
This commit is contained in:
@@ -42,7 +42,6 @@
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/scatterlist.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/async.h>
|
||||
#include <linux/log2.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/glob.h>
|
||||
@@ -5778,7 +5777,7 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
|
||||
/* perform each probe asynchronously */
|
||||
for (i = 0; i < host->n_ports; i++) {
|
||||
struct ata_port *ap = host->ports[i];
|
||||
async_schedule(async_port_probe, ap);
|
||||
ap->cookie = async_schedule(async_port_probe, ap);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -5920,11 +5919,11 @@ void ata_host_detach(struct ata_host *host)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Ensure ata_port probe has completed */
|
||||
async_synchronize_full();
|
||||
|
||||
for (i = 0; i < host->n_ports; i++)
|
||||
for (i = 0; i < host->n_ports; i++) {
|
||||
/* Ensure ata_port probe has completed */
|
||||
async_synchronize_cookie(host->ports[i]->cookie + 1);
|
||||
ata_port_detach(host->ports[i]);
|
||||
}
|
||||
|
||||
/* the host is dead now, dissociate ACPI */
|
||||
ata_acpi_dissociate(host);
|
||||
|
@@ -3684,12 +3684,13 @@ static unsigned int ata_scsi_mode_select_xlat(struct ata_queued_cmd *qc)
|
||||
{
|
||||
struct scsi_cmnd *scmd = qc->scsicmd;
|
||||
const u8 *cdb = scmd->cmnd;
|
||||
const u8 *p;
|
||||
u8 pg, spg;
|
||||
unsigned six_byte, pg_len, hdr_len, bd_len;
|
||||
int len;
|
||||
u16 fp = (u16)-1;
|
||||
u8 bp = 0xff;
|
||||
u8 buffer[64];
|
||||
const u8 *p = buffer;
|
||||
|
||||
VPRINTK("ENTER\n");
|
||||
|
||||
@@ -3723,12 +3724,14 @@ static unsigned int ata_scsi_mode_select_xlat(struct ata_queued_cmd *qc)
|
||||
if (!scsi_sg_count(scmd) || scsi_sglist(scmd)->length < len)
|
||||
goto invalid_param_len;
|
||||
|
||||
p = page_address(sg_page(scsi_sglist(scmd)));
|
||||
|
||||
/* Move past header and block descriptors. */
|
||||
if (len < hdr_len)
|
||||
goto invalid_param_len;
|
||||
|
||||
if (!sg_copy_to_buffer(scsi_sglist(scmd), scsi_sg_count(scmd),
|
||||
buffer, sizeof(buffer)))
|
||||
goto invalid_param_len;
|
||||
|
||||
if (six_byte)
|
||||
bd_len = p[3];
|
||||
else
|
||||
|
@@ -907,7 +907,7 @@ static int sata_rcar_probe(struct platform_device *pdev)
|
||||
pm_runtime_enable(dev);
|
||||
ret = pm_runtime_get_sync(dev);
|
||||
if (ret < 0)
|
||||
goto err_pm_disable;
|
||||
goto err_pm_put;
|
||||
|
||||
host = ata_host_alloc(dev, 1);
|
||||
if (!host) {
|
||||
@@ -937,7 +937,6 @@ static int sata_rcar_probe(struct platform_device *pdev)
|
||||
|
||||
err_pm_put:
|
||||
pm_runtime_put(dev);
|
||||
err_pm_disable:
|
||||
pm_runtime_disable(dev);
|
||||
return ret;
|
||||
}
|
||||
@@ -991,8 +990,10 @@ static int sata_rcar_resume(struct device *dev)
|
||||
int ret;
|
||||
|
||||
ret = pm_runtime_get_sync(dev);
|
||||
if (ret < 0)
|
||||
if (ret < 0) {
|
||||
pm_runtime_put(dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (priv->type == RCAR_GEN3_SATA) {
|
||||
sata_rcar_init_module(priv);
|
||||
@@ -1017,8 +1018,10 @@ static int sata_rcar_restore(struct device *dev)
|
||||
int ret;
|
||||
|
||||
ret = pm_runtime_get_sync(dev);
|
||||
if (ret < 0)
|
||||
if (ret < 0) {
|
||||
pm_runtime_put(dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
sata_rcar_setup_port(host);
|
||||
|
||||
|
@@ -22,6 +22,7 @@
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/cdrom.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/async.h>
|
||||
|
||||
/*
|
||||
* Define if arch has non-standard setup. This is a _PCI_ standard
|
||||
@@ -872,6 +873,8 @@ struct ata_port {
|
||||
struct timer_list fastdrain_timer;
|
||||
unsigned long fastdrain_cnt;
|
||||
|
||||
async_cookie_t cookie;
|
||||
|
||||
int em_message_type;
|
||||
void *private_data;
|
||||
|
||||
|
Reference in New Issue
Block a user