diff options
| author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-03-25 05:51:53 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-03-25 05:51:53 -0400 |
| commit | ff85f707ac49ad77b7cf8dcef38e7fcd468ca3d6 (patch) | |
| tree | 886db57888058d507c6a14000cf4dd2b581311e1 /drivers/char | |
| parent | e9533ae539d5cc3d5fc501529d2df7b77e20449c (diff) | |
| parent | bc465aa9d045feb0e13b4a8f32cc33c1943f62d6 (diff) | |
Merge 4.0-rc5 into char-misc-next
We want those fixes in here as well.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/char')
| -rw-r--r-- | drivers/char/tpm/tpm-chip.c | 34 | ||||
| -rw-r--r-- | drivers/char/tpm/tpm_ibmvtpm.c | 10 | ||||
| -rw-r--r-- | drivers/char/tpm/tpm_ibmvtpm.h | 6 | ||||
| -rw-r--r-- | drivers/char/virtio_console.c | 19 |
4 files changed, 40 insertions, 29 deletions
diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c index 1d278ccd751f..e096e9cddb40 100644 --- a/drivers/char/tpm/tpm-chip.c +++ b/drivers/char/tpm/tpm-chip.c | |||
| @@ -140,24 +140,24 @@ static int tpm_dev_add_device(struct tpm_chip *chip) | |||
| 140 | { | 140 | { |
| 141 | int rc; | 141 | int rc; |
| 142 | 142 | ||
| 143 | rc = device_add(&chip->dev); | 143 | rc = cdev_add(&chip->cdev, chip->dev.devt, 1); |
| 144 | if (rc) { | 144 | if (rc) { |
| 145 | dev_err(&chip->dev, | 145 | dev_err(&chip->dev, |
| 146 | "unable to device_register() %s, major %d, minor %d, err=%d\n", | 146 | "unable to cdev_add() %s, major %d, minor %d, err=%d\n", |
| 147 | chip->devname, MAJOR(chip->dev.devt), | 147 | chip->devname, MAJOR(chip->dev.devt), |
| 148 | MINOR(chip->dev.devt), rc); | 148 | MINOR(chip->dev.devt), rc); |
| 149 | 149 | ||
| 150 | device_unregister(&chip->dev); | ||
| 150 | return rc; | 151 | return rc; |
| 151 | } | 152 | } |
| 152 | 153 | ||
| 153 | rc = cdev_add(&chip->cdev, chip->dev.devt, 1); | 154 | rc = device_add(&chip->dev); |
| 154 | if (rc) { | 155 | if (rc) { |
| 155 | dev_err(&chip->dev, | 156 | dev_err(&chip->dev, |
| 156 | "unable to cdev_add() %s, major %d, minor %d, err=%d\n", | 157 | "unable to device_register() %s, major %d, minor %d, err=%d\n", |
| 157 | chip->devname, MAJOR(chip->dev.devt), | 158 | chip->devname, MAJOR(chip->dev.devt), |
| 158 | MINOR(chip->dev.devt), rc); | 159 | MINOR(chip->dev.devt), rc); |
| 159 | 160 | ||
| 160 | device_unregister(&chip->dev); | ||
| 161 | return rc; | 161 | return rc; |
| 162 | } | 162 | } |
| 163 | 163 | ||
| @@ -174,27 +174,17 @@ static void tpm_dev_del_device(struct tpm_chip *chip) | |||
| 174 | * tpm_chip_register() - create a character device for the TPM chip | 174 | * tpm_chip_register() - create a character device for the TPM chip |
| 175 | * @chip: TPM chip to use. | 175 | * @chip: TPM chip to use. |
| 176 | * | 176 | * |
| 177 | * Creates a character device for the TPM chip and adds sysfs interfaces for | 177 | * Creates a character device for the TPM chip and adds sysfs attributes for |
| 178 | * the device, PPI and TCPA. As the last step this function adds the | 178 | * the device. As the last step this function adds the chip to the list of TPM |
| 179 | * chip to the list of TPM chips available for use. | 179 | * chips available for in-kernel use. |
| 180 | * | 180 | * |
| 181 | * NOTE: This function should be only called after the chip initialization | 181 | * This function should be only called after the chip initialization is |
| 182 | * is complete. | 182 | * complete. |
| 183 | * | ||
| 184 | * Called from tpm_<specific>.c probe function only for devices | ||
| 185 | * the driver has determined it should claim. Prior to calling | ||
| 186 | * this function the specific probe function has called pci_enable_device | ||
| 187 | * upon errant exit from this function specific probe function should call | ||
| 188 | * pci_disable_device | ||
| 189 | */ | 183 | */ |
| 190 | int tpm_chip_register(struct tpm_chip *chip) | 184 | int tpm_chip_register(struct tpm_chip *chip) |
| 191 | { | 185 | { |
| 192 | int rc; | 186 | int rc; |
| 193 | 187 | ||
| 194 | rc = tpm_dev_add_device(chip); | ||
| 195 | if (rc) | ||
| 196 | return rc; | ||
| 197 | |||
| 198 | /* Populate sysfs for TPM1 devices. */ | 188 | /* Populate sysfs for TPM1 devices. */ |
| 199 | if (!(chip->flags & TPM_CHIP_FLAG_TPM2)) { | 189 | if (!(chip->flags & TPM_CHIP_FLAG_TPM2)) { |
| 200 | rc = tpm_sysfs_add_device(chip); | 190 | rc = tpm_sysfs_add_device(chip); |
| @@ -208,6 +198,10 @@ int tpm_chip_register(struct tpm_chip *chip) | |||
| 208 | chip->bios_dir = tpm_bios_log_setup(chip->devname); | 198 | chip->bios_dir = tpm_bios_log_setup(chip->devname); |
| 209 | } | 199 | } |
| 210 | 200 | ||
| 201 | rc = tpm_dev_add_device(chip); | ||
| 202 | if (rc) | ||
| 203 | return rc; | ||
| 204 | |||
| 211 | /* Make the chip available. */ | 205 | /* Make the chip available. */ |
| 212 | spin_lock(&driver_lock); | 206 | spin_lock(&driver_lock); |
| 213 | list_add_rcu(&chip->list, &tpm_chip_list); | 207 | list_add_rcu(&chip->list, &tpm_chip_list); |
diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c index b1e53e3aece5..42ffa5e7a1e0 100644 --- a/drivers/char/tpm/tpm_ibmvtpm.c +++ b/drivers/char/tpm/tpm_ibmvtpm.c | |||
| @@ -124,7 +124,7 @@ static int tpm_ibmvtpm_send(struct tpm_chip *chip, u8 *buf, size_t count) | |||
| 124 | { | 124 | { |
| 125 | struct ibmvtpm_dev *ibmvtpm; | 125 | struct ibmvtpm_dev *ibmvtpm; |
| 126 | struct ibmvtpm_crq crq; | 126 | struct ibmvtpm_crq crq; |
| 127 | u64 *word = (u64 *) &crq; | 127 | __be64 *word = (__be64 *)&crq; |
| 128 | int rc; | 128 | int rc; |
| 129 | 129 | ||
| 130 | ibmvtpm = (struct ibmvtpm_dev *)TPM_VPRIV(chip); | 130 | ibmvtpm = (struct ibmvtpm_dev *)TPM_VPRIV(chip); |
| @@ -145,11 +145,11 @@ static int tpm_ibmvtpm_send(struct tpm_chip *chip, u8 *buf, size_t count) | |||
| 145 | memcpy((void *)ibmvtpm->rtce_buf, (void *)buf, count); | 145 | memcpy((void *)ibmvtpm->rtce_buf, (void *)buf, count); |
| 146 | crq.valid = (u8)IBMVTPM_VALID_CMD; | 146 | crq.valid = (u8)IBMVTPM_VALID_CMD; |
| 147 | crq.msg = (u8)VTPM_TPM_COMMAND; | 147 | crq.msg = (u8)VTPM_TPM_COMMAND; |
| 148 | crq.len = (u16)count; | 148 | crq.len = cpu_to_be16(count); |
| 149 | crq.data = ibmvtpm->rtce_dma_handle; | 149 | crq.data = cpu_to_be32(ibmvtpm->rtce_dma_handle); |
| 150 | 150 | ||
| 151 | rc = ibmvtpm_send_crq(ibmvtpm->vdev, cpu_to_be64(word[0]), | 151 | rc = ibmvtpm_send_crq(ibmvtpm->vdev, be64_to_cpu(word[0]), |
| 152 | cpu_to_be64(word[1])); | 152 | be64_to_cpu(word[1])); |
| 153 | if (rc != H_SUCCESS) { | 153 | if (rc != H_SUCCESS) { |
| 154 | dev_err(ibmvtpm->dev, "tpm_ibmvtpm_send failed rc=%d\n", rc); | 154 | dev_err(ibmvtpm->dev, "tpm_ibmvtpm_send failed rc=%d\n", rc); |
| 155 | rc = 0; | 155 | rc = 0; |
diff --git a/drivers/char/tpm/tpm_ibmvtpm.h b/drivers/char/tpm/tpm_ibmvtpm.h index f595f14426bf..6af92890518f 100644 --- a/drivers/char/tpm/tpm_ibmvtpm.h +++ b/drivers/char/tpm/tpm_ibmvtpm.h | |||
| @@ -22,9 +22,9 @@ | |||
| 22 | struct ibmvtpm_crq { | 22 | struct ibmvtpm_crq { |
| 23 | u8 valid; | 23 | u8 valid; |
| 24 | u8 msg; | 24 | u8 msg; |
| 25 | u16 len; | 25 | __be16 len; |
| 26 | u32 data; | 26 | __be32 data; |
| 27 | u64 reserved; | 27 | __be64 reserved; |
| 28 | } __attribute__((packed, aligned(8))); | 28 | } __attribute__((packed, aligned(8))); |
| 29 | 29 | ||
| 30 | struct ibmvtpm_crq_queue { | 30 | struct ibmvtpm_crq_queue { |
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index fae2dbbf5745..72d7028f779b 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
| @@ -142,6 +142,7 @@ struct ports_device { | |||
| 142 | * notification | 142 | * notification |
| 143 | */ | 143 | */ |
| 144 | struct work_struct control_work; | 144 | struct work_struct control_work; |
| 145 | struct work_struct config_work; | ||
| 145 | 146 | ||
| 146 | struct list_head ports; | 147 | struct list_head ports; |
| 147 | 148 | ||
| @@ -1837,10 +1838,21 @@ static void config_intr(struct virtio_device *vdev) | |||
| 1837 | 1838 | ||
| 1838 | portdev = vdev->priv; | 1839 | portdev = vdev->priv; |
| 1839 | 1840 | ||
| 1841 | if (!use_multiport(portdev)) | ||
| 1842 | schedule_work(&portdev->config_work); | ||
| 1843 | } | ||
| 1844 | |||
| 1845 | static void config_work_handler(struct work_struct *work) | ||
| 1846 | { | ||
| 1847 | struct ports_device *portdev; | ||
| 1848 | |||
| 1849 | portdev = container_of(work, struct ports_device, control_work); | ||
| 1840 | if (!use_multiport(portdev)) { | 1850 | if (!use_multiport(portdev)) { |
| 1851 | struct virtio_device *vdev; | ||
| 1841 | struct port *port; | 1852 | struct port *port; |
| 1842 | u16 rows, cols; | 1853 | u16 rows, cols; |
| 1843 | 1854 | ||
| 1855 | vdev = portdev->vdev; | ||
| 1844 | virtio_cread(vdev, struct virtio_console_config, cols, &cols); | 1856 | virtio_cread(vdev, struct virtio_console_config, cols, &cols); |
| 1845 | virtio_cread(vdev, struct virtio_console_config, rows, &rows); | 1857 | virtio_cread(vdev, struct virtio_console_config, rows, &rows); |
| 1846 | 1858 | ||
| @@ -2040,12 +2052,14 @@ static int virtcons_probe(struct virtio_device *vdev) | |||
| 2040 | 2052 | ||
| 2041 | virtio_device_ready(portdev->vdev); | 2053 | virtio_device_ready(portdev->vdev); |
| 2042 | 2054 | ||
| 2055 | INIT_WORK(&portdev->config_work, &config_work_handler); | ||
| 2056 | INIT_WORK(&portdev->control_work, &control_work_handler); | ||
| 2057 | |||
| 2043 | if (multiport) { | 2058 | if (multiport) { |
| 2044 | unsigned int nr_added_bufs; | 2059 | unsigned int nr_added_bufs; |
| 2045 | 2060 | ||
| 2046 | spin_lock_init(&portdev->c_ivq_lock); | 2061 | spin_lock_init(&portdev->c_ivq_lock); |
| 2047 | spin_lock_init(&portdev->c_ovq_lock); | 2062 | spin_lock_init(&portdev->c_ovq_lock); |
| 2048 | INIT_WORK(&portdev->control_work, &control_work_handler); | ||
| 2049 | 2063 | ||
| 2050 | nr_added_bufs = fill_queue(portdev->c_ivq, | 2064 | nr_added_bufs = fill_queue(portdev->c_ivq, |
| 2051 | &portdev->c_ivq_lock); | 2065 | &portdev->c_ivq_lock); |
| @@ -2113,6 +2127,8 @@ static void virtcons_remove(struct virtio_device *vdev) | |||
| 2113 | /* Finish up work that's lined up */ | 2127 | /* Finish up work that's lined up */ |
| 2114 | if (use_multiport(portdev)) | 2128 | if (use_multiport(portdev)) |
| 2115 | cancel_work_sync(&portdev->control_work); | 2129 | cancel_work_sync(&portdev->control_work); |
| 2130 | else | ||
| 2131 | cancel_work_sync(&portdev->config_work); | ||
| 2116 | 2132 | ||
| 2117 | list_for_each_entry_safe(port, port2, &portdev->ports, list) | 2133 | list_for_each_entry_safe(port, port2, &portdev->ports, list) |
| 2118 | unplug_port(port); | 2134 | unplug_port(port); |
| @@ -2164,6 +2180,7 @@ static int virtcons_freeze(struct virtio_device *vdev) | |||
| 2164 | 2180 | ||
| 2165 | virtqueue_disable_cb(portdev->c_ivq); | 2181 | virtqueue_disable_cb(portdev->c_ivq); |
| 2166 | cancel_work_sync(&portdev->control_work); | 2182 | cancel_work_sync(&portdev->control_work); |
| 2183 | cancel_work_sync(&portdev->config_work); | ||
| 2167 | /* | 2184 | /* |
| 2168 | * Once more: if control_work_handler() was running, it would | 2185 | * Once more: if control_work_handler() was running, it would |
| 2169 | * enable the cb as the last step. | 2186 | * enable the cb as the last step. |
