Skip to content

Commit 82e1f00

Browse files
James BottomleyJames Bottomley
authored andcommitted
Merge branch 'misc' into for-next
2 parents 2132df1 + 17d1194 commit 82e1f00

File tree

16 files changed

+270
-151
lines changed

16 files changed

+270
-151
lines changed

drivers/scsi/Kconfig

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -834,21 +834,6 @@ config SCSI_IMM
834834
To compile this driver as a module, choose M here: the
835835
module will be called imm.
836836

837-
config SCSI_IZIP_EPP16
838-
bool "ppa/imm option - Use slow (but safe) EPP-16"
839-
depends on SCSI_IMM
840-
help
841-
EPP (Enhanced Parallel Port) is a standard for parallel ports which
842-
allows them to act as expansion buses that can handle up to 64
843-
peripheral devices.
844-
845-
Some parallel port chipsets are slower than their motherboard, and
846-
so we have to control the state of the chipset's FIFO queue every
847-
now and then to avoid data loss. This will be done if you say Y
848-
here.
849-
850-
Generally, saying Y is the safe option and slows things down a bit.
851-
852837
config SCSI_IZIP_SLOW_CTR
853838
bool "ppa/imm option - Assume slow parport control register"
854839
depends on SCSI_PPA || SCSI_IMM

drivers/scsi/esas2r/esas2r_ioctl.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
* USA.
4242
*/
4343

44+
#include <linux/bitfield.h>
45+
4446
#include "esas2r.h"
4547

4648
/*
@@ -792,16 +794,10 @@ static int hba_ioctl_callback(struct esas2r_adapter *a,
792794
pcie_capability_read_dword(a->pcid, PCI_EXP_LNKCAP,
793795
&caps);
794796

795-
gai->pci.link_speed_curr =
796-
(u8)(stat & PCI_EXP_LNKSTA_CLS);
797-
gai->pci.link_speed_max =
798-
(u8)(caps & PCI_EXP_LNKCAP_SLS);
799-
gai->pci.link_width_curr =
800-
(u8)((stat & PCI_EXP_LNKSTA_NLW)
801-
>> PCI_EXP_LNKSTA_NLW_SHIFT);
802-
gai->pci.link_width_max =
803-
(u8)((caps & PCI_EXP_LNKCAP_MLW)
804-
>> 4);
797+
gai->pci.link_speed_curr = FIELD_GET(PCI_EXP_LNKSTA_CLS, stat);
798+
gai->pci.link_speed_max = FIELD_GET(PCI_EXP_LNKCAP_SLS, caps);
799+
gai->pci.link_width_curr = FIELD_GET(PCI_EXP_LNKSTA_NLW, stat);
800+
gai->pci.link_width_max = FIELD_GET(PCI_EXP_LNKCAP_MLW, caps);
805801
}
806802

807803
gai->pci.msi_vector_cnt = 1;

drivers/scsi/imm.c

Lines changed: 37 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,15 @@ typedef struct {
5151
} imm_struct;
5252

5353
static void imm_reset_pulse(unsigned int base);
54-
static int device_check(imm_struct *dev);
54+
static int device_check(imm_struct *dev, bool autodetect);
5555

5656
#include "imm.h"
5757

58+
static unsigned int mode = IMM_AUTODETECT;
59+
module_param(mode, uint, 0644);
60+
MODULE_PARM_DESC(mode, "Transfer mode (0 = Autodetect, 1 = SPP 4-bit, "
61+
"2 = SPP 8-bit, 3 = EPP 8-bit, 4 = EPP 16-bit, 5 = EPP 32-bit");
62+
5863
static inline imm_struct *imm_dev(struct Scsi_Host *host)
5964
{
6065
return *(imm_struct **)&host->hostdata;
@@ -366,13 +371,10 @@ static int imm_out(imm_struct *dev, char *buffer, int len)
366371
case IMM_EPP_8:
367372
epp_reset(ppb);
368373
w_ctr(ppb, 0x4);
369-
#ifdef CONFIG_SCSI_IZIP_EPP16
370-
if (!(((long) buffer | len) & 0x01))
371-
outsw(ppb + 4, buffer, len >> 1);
372-
#else
373-
if (!(((long) buffer | len) & 0x03))
374+
if (dev->mode == IMM_EPP_32 && !(((long) buffer | len) & 0x03))
374375
outsl(ppb + 4, buffer, len >> 2);
375-
#endif
376+
else if (dev->mode == IMM_EPP_16 && !(((long) buffer | len) & 0x01))
377+
outsw(ppb + 4, buffer, len >> 1);
376378
else
377379
outsb(ppb + 4, buffer, len);
378380
w_ctr(ppb, 0xc);
@@ -426,13 +428,10 @@ static int imm_in(imm_struct *dev, char *buffer, int len)
426428
case IMM_EPP_8:
427429
epp_reset(ppb);
428430
w_ctr(ppb, 0x24);
429-
#ifdef CONFIG_SCSI_IZIP_EPP16
430-
if (!(((long) buffer | len) & 0x01))
431-
insw(ppb + 4, buffer, len >> 1);
432-
#else
433-
if (!(((long) buffer | len) & 0x03))
434-
insl(ppb + 4, buffer, len >> 2);
435-
#endif
431+
if (dev->mode == IMM_EPP_32 && !(((long) buffer | len) & 0x03))
432+
insw(ppb + 4, buffer, len >> 2);
433+
else if (dev->mode == IMM_EPP_16 && !(((long) buffer | len) & 0x01))
434+
insl(ppb + 4, buffer, len >> 1);
436435
else
437436
insb(ppb + 4, buffer, len);
438437
w_ctr(ppb, 0x2c);
@@ -589,13 +588,28 @@ static int imm_select(imm_struct *dev, int target)
589588

590589
static int imm_init(imm_struct *dev)
591590
{
591+
bool autodetect = dev->mode == IMM_AUTODETECT;
592+
593+
if (autodetect) {
594+
int modes = dev->dev->port->modes;
595+
596+
/* Mode detection works up the chain of speed
597+
* This avoids a nasty if-then-else-if-... tree
598+
*/
599+
dev->mode = IMM_NIBBLE;
600+
601+
if (modes & PARPORT_MODE_TRISTATE)
602+
dev->mode = IMM_PS2;
603+
}
604+
592605
if (imm_connect(dev, 0) != 1)
593606
return -EIO;
594607
imm_reset_pulse(dev->base);
595608
mdelay(1); /* Delay to allow devices to settle */
596609
imm_disconnect(dev);
597610
mdelay(1); /* Another delay to allow devices to settle */
598-
return device_check(dev);
611+
612+
return device_check(dev, autodetect);
599613
}
600614

601615
static inline int imm_send_command(struct scsi_cmnd *cmd)
@@ -1000,7 +1014,7 @@ static int imm_reset(struct scsi_cmnd *cmd)
10001014
return SUCCESS;
10011015
}
10021016

1003-
static int device_check(imm_struct *dev)
1017+
static int device_check(imm_struct *dev, bool autodetect)
10041018
{
10051019
/* This routine looks for a device and then attempts to use EPP
10061020
to send a command. If all goes as planned then EPP is available. */
@@ -1012,8 +1026,8 @@ static int device_check(imm_struct *dev)
10121026
old_mode = dev->mode;
10131027
for (loop = 0; loop < 8; loop++) {
10141028
/* Attempt to use EPP for Test Unit Ready */
1015-
if ((ppb & 0x0007) == 0x0000)
1016-
dev->mode = IMM_EPP_32;
1029+
if (autodetect && (ppb & 0x0007) == 0x0000)
1030+
dev->mode = IMM_EPP_8;
10171031

10181032
second_pass:
10191033
imm_connect(dev, CONNECT_EPP_MAYBE);
@@ -1038,7 +1052,7 @@ static int device_check(imm_struct *dev)
10381052
udelay(1000);
10391053
imm_disconnect(dev);
10401054
udelay(1000);
1041-
if (dev->mode == IMM_EPP_32) {
1055+
if (dev->mode != old_mode) {
10421056
dev->mode = old_mode;
10431057
goto second_pass;
10441058
}
@@ -1063,7 +1077,7 @@ static int device_check(imm_struct *dev)
10631077
udelay(1000);
10641078
imm_disconnect(dev);
10651079
udelay(1000);
1066-
if (dev->mode == IMM_EPP_32) {
1080+
if (dev->mode != old_mode) {
10671081
dev->mode = old_mode;
10681082
goto second_pass;
10691083
}
@@ -1150,7 +1164,6 @@ static int __imm_attach(struct parport *pb)
11501164
DECLARE_WAIT_QUEUE_HEAD_ONSTACK(waiting);
11511165
DEFINE_WAIT(wait);
11521166
int ports;
1153-
int modes, ppb;
11541167
int err = -ENOMEM;
11551168
struct pardev_cb imm_cb;
11561169

@@ -1162,7 +1175,7 @@ static int __imm_attach(struct parport *pb)
11621175

11631176

11641177
dev->base = -1;
1165-
dev->mode = IMM_AUTODETECT;
1178+
dev->mode = mode < IMM_UNKNOWN ? mode : IMM_AUTODETECT;
11661179
INIT_LIST_HEAD(&dev->list);
11671180

11681181
temp = find_parent();
@@ -1197,18 +1210,9 @@ static int __imm_attach(struct parport *pb)
11971210
}
11981211
dev->waiting = NULL;
11991212
finish_wait(&waiting, &wait);
1200-
ppb = dev->base = dev->dev->port->base;
1213+
dev->base = dev->dev->port->base;
12011214
dev->base_hi = dev->dev->port->base_hi;
1202-
w_ctr(ppb, 0x0c);
1203-
modes = dev->dev->port->modes;
1204-
1205-
/* Mode detection works up the chain of speed
1206-
* This avoids a nasty if-then-else-if-... tree
1207-
*/
1208-
dev->mode = IMM_NIBBLE;
1209-
1210-
if (modes & PARPORT_MODE_TRISTATE)
1211-
dev->mode = IMM_PS2;
1215+
w_ctr(dev->base, 0x0c);
12121216

12131217
/* Done configuration */
12141218

drivers/scsi/imm.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,7 @@ static char *IMM_MODE_STRING[] =
100100
[IMM_PS2] = "PS/2",
101101
[IMM_EPP_8] = "EPP 8 bit",
102102
[IMM_EPP_16] = "EPP 16 bit",
103-
#ifdef CONFIG_SCSI_IZIP_EPP16
104-
[IMM_EPP_32] = "EPP 16 bit",
105-
#else
106103
[IMM_EPP_32] = "EPP 32 bit",
107-
#endif
108104
[IMM_UNKNOWN] = "Unknown",
109105
};
110106

drivers/scsi/libsas/sas_discover.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ static void sas_resume_devices(struct work_struct *work)
275275
*
276276
* See comment in sas_discover_sata().
277277
*/
278-
int sas_discover_end_dev(struct domain_device *dev)
278+
static int sas_discover_end_dev(struct domain_device *dev)
279279
{
280280
return sas_notify_lldd_dev_found(dev);
281281
}

drivers/scsi/libsas/sas_init.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,8 @@ int sas_phy_reset(struct sas_phy *phy, int hard_reset)
315315
}
316316
EXPORT_SYMBOL_GPL(sas_phy_reset);
317317

318-
int sas_set_phy_speed(struct sas_phy *phy,
319-
struct sas_phy_linkrates *rates)
318+
static int sas_set_phy_speed(struct sas_phy *phy,
319+
struct sas_phy_linkrates *rates)
320320
{
321321
int ret;
322322

drivers/scsi/libsas/sas_internal.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@ struct sas_phy_data {
3939
struct sas_work enable_work;
4040
};
4141

42+
void sas_hash_addr(u8 *hashed, const u8 *sas_addr);
43+
44+
int sas_discover_root_expander(struct domain_device *dev);
45+
46+
int sas_ex_revalidate_domain(struct domain_device *dev);
47+
void sas_unregister_domain_devices(struct asd_sas_port *port, int gone);
48+
void sas_init_disc(struct sas_discovery *disc, struct asd_sas_port *port);
49+
void sas_discover_event(struct asd_sas_port *port, enum discover_event ev);
50+
51+
void sas_init_dev(struct domain_device *dev);
52+
void sas_unregister_dev(struct asd_sas_port *port, struct domain_device *dev);
53+
4254
void sas_scsi_recover_host(struct Scsi_Host *shost);
4355

4456
int sas_register_phys(struct sas_ha_struct *sas_ha);

drivers/scsi/qla2xxx/qla_os.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
#include "qla_def.h"
77

8+
#include <linux/bitfield.h>
89
#include <linux/moduleparam.h>
910
#include <linux/vmalloc.h>
1011
#include <linux/delay.h>
@@ -633,8 +634,8 @@ qla24xx_pci_info_str(struct scsi_qla_host *vha, char *str, size_t str_len)
633634
const char *speed_str;
634635

635636
pcie_capability_read_dword(ha->pdev, PCI_EXP_LNKCAP, &lstat);
636-
lspeed = lstat & PCI_EXP_LNKCAP_SLS;
637-
lwidth = (lstat & PCI_EXP_LNKCAP_MLW) >> 4;
637+
lspeed = FIELD_GET(PCI_EXP_LNKCAP_SLS, lstat);
638+
lwidth = FIELD_GET(PCI_EXP_LNKCAP_MLW, lstat);
638639

639640
switch (lspeed) {
640641
case 1:

drivers/ufs/core/ufshcd.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,8 @@ static void ufshcd_add_command_trace(struct ufs_hba *hba, unsigned int tag,
447447
} else {
448448
doorbell = ufshcd_readl(hba, REG_UTP_TRANSFER_REQ_DOOR_BELL);
449449
}
450-
trace_ufshcd_command(dev_name(hba->dev), str_t, tag,
451-
doorbell, hwq_id, transfer_len, intr, lba, opcode, group_id);
450+
trace_ufshcd_command(cmd->device, str_t, tag, doorbell, hwq_id,
451+
transfer_len, intr, lba, opcode, group_id);
452452
}
453453

454454
static void ufshcd_print_clk_freqs(struct ufs_hba *hba)
@@ -8723,7 +8723,8 @@ static int ufshcd_probe_hba(struct ufs_hba *hba, bool init_dev_params)
87238723
if (ret)
87248724
goto out;
87258725

8726-
if (hba->quirks & UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH) {
8726+
if (!hba->pm_op_in_progress &&
8727+
(hba->quirks & UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH)) {
87278728
/* Reset the device and controller before doing reinit */
87288729
ufshcd_device_reset(hba);
87298730
ufshcd_hba_stop(hba);

drivers/ufs/host/ufs-mediatek.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ static int ufs_mtk_vreg_fix_vcc(struct ufs_hba *hba)
806806
return 0;
807807
}
808808

809-
err = ufshcd_populate_vreg(dev, vcc_name, &info->vcc);
809+
err = ufshcd_populate_vreg(dev, vcc_name, &info->vcc, false);
810810
if (err)
811811
return err;
812812

0 commit comments

Comments
 (0)