Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: hv: Convert camel case local variables in storvsc.c to lowercase

Convert camel case local variables in storvsc.c to lowercase

Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Hank Janssen and committed by
Greg Kroah-Hartman
f638859e 02e37db7

+248 -246
+248 -246
drivers/staging/hv/storvsc.c
··· 50 50 /* 0 indicates the device is being destroyed */ 51 51 atomic_t ref_count; 52 52 53 - atomic_t num_outstanding_requests; 53 + atomic_t num_outstanding_req; 54 54 55 55 /* 56 56 * Each unique Port/Path/Target represents 1 channel ie scsi ··· 81 81 }; 82 82 83 83 84 - static inline struct storvsc_device *alloc_stor_device(struct hv_device *Device) 84 + static inline struct storvsc_device *alloc_stor_device(struct hv_device *device) 85 85 { 86 - struct storvsc_device *storDevice; 86 + struct storvsc_device *stor_device; 87 87 88 - storDevice = kzalloc(sizeof(struct storvsc_device), GFP_KERNEL); 89 - if (!storDevice) 88 + stor_device = kzalloc(sizeof(struct storvsc_device), GFP_KERNEL); 89 + if (!stor_device) 90 90 return NULL; 91 91 92 92 /* Set to 2 to allow both inbound and outbound traffics */ 93 93 /* (ie get_stor_device() and must_get_stor_device()) to proceed. */ 94 - atomic_cmpxchg(&storDevice->ref_count, 0, 2); 94 + atomic_cmpxchg(&stor_device->ref_count, 0, 2); 95 95 96 - storDevice->device = Device; 97 - Device->Extension = storDevice; 96 + stor_device->device = device; 97 + device->Extension = stor_device; 98 98 99 - return storDevice; 99 + return stor_device; 100 100 } 101 101 102 - static inline void free_stor_device(struct storvsc_device *Device) 102 + static inline void free_stor_device(struct storvsc_device *device) 103 103 { 104 - /* ASSERT(atomic_read(&Device->ref_count) == 0); */ 105 - kfree(Device); 104 + /* ASSERT(atomic_read(&device->ref_count) == 0); */ 105 + kfree(device); 106 106 } 107 107 108 108 /* Get the stordevice object iff exists and its refcount > 1 */ 109 - static inline struct storvsc_device *get_stor_device(struct hv_device *Device) 109 + static inline struct storvsc_device *get_stor_device(struct hv_device *device) 110 110 { 111 - struct storvsc_device *storDevice; 111 + struct storvsc_device *stor_device; 112 112 113 - storDevice = (struct storvsc_device *)Device->Extension; 114 - if (storDevice && atomic_read(&storDevice->ref_count) > 1) 115 - atomic_inc(&storDevice->ref_count); 113 + stor_device = (struct storvsc_device *)device->Extension; 114 + if (stor_device && atomic_read(&stor_device->ref_count) > 1) 115 + atomic_inc(&stor_device->ref_count); 116 116 else 117 - storDevice = NULL; 117 + stor_device = NULL; 118 118 119 - return storDevice; 119 + return stor_device; 120 120 } 121 121 122 122 /* Get the stordevice object iff exists and its refcount > 0 */ 123 123 static inline struct storvsc_device *must_get_stor_device( 124 - struct hv_device *Device) 124 + struct hv_device *device) 125 125 { 126 - struct storvsc_device *storDevice; 126 + struct storvsc_device *stor_device; 127 127 128 - storDevice = (struct storvsc_device *)Device->Extension; 129 - if (storDevice && atomic_read(&storDevice->ref_count)) 130 - atomic_inc(&storDevice->ref_count); 128 + stor_device = (struct storvsc_device *)device->Extension; 129 + if (stor_device && atomic_read(&stor_device->ref_count)) 130 + atomic_inc(&stor_device->ref_count); 131 131 else 132 - storDevice = NULL; 132 + stor_device = NULL; 133 133 134 - return storDevice; 134 + return stor_device; 135 135 } 136 136 137 - static inline void put_stor_device(struct hv_device *Device) 137 + static inline void put_stor_device(struct hv_device *device) 138 138 { 139 - struct storvsc_device *storDevice; 139 + struct storvsc_device *stor_device; 140 140 141 - storDevice = (struct storvsc_device *)Device->Extension; 142 - /* ASSERT(storDevice); */ 141 + stor_device = (struct storvsc_device *)device->Extension; 142 + /* ASSERT(stor_device); */ 143 143 144 - atomic_dec(&storDevice->ref_count); 145 - /* ASSERT(atomic_read(&storDevice->ref_count)); */ 144 + atomic_dec(&stor_device->ref_count); 145 + /* ASSERT(atomic_read(&stor_device->ref_count)); */ 146 146 } 147 147 148 148 /* Drop ref count to 1 to effectively disable get_stor_device() */ 149 149 static inline struct storvsc_device *release_stor_device( 150 - struct hv_device *Device) 150 + struct hv_device *device) 151 151 { 152 - struct storvsc_device *storDevice; 152 + struct storvsc_device *stor_device; 153 153 154 - storDevice = (struct storvsc_device *)Device->Extension; 155 - /* ASSERT(storDevice); */ 154 + stor_device = (struct storvsc_device *)device->Extension; 155 + /* ASSERT(stor_device); */ 156 156 157 157 /* Busy wait until the ref drop to 2, then set it to 1 */ 158 - while (atomic_cmpxchg(&storDevice->ref_count, 2, 1) != 2) 158 + while (atomic_cmpxchg(&stor_device->ref_count, 2, 1) != 2) 159 159 udelay(100); 160 160 161 - return storDevice; 161 + return stor_device; 162 162 } 163 163 164 - /* Drop ref count to 0. No one can use StorDevice object. */ 164 + /* Drop ref count to 0. No one can use stor_device object. */ 165 165 static inline struct storvsc_device *final_release_stor_device( 166 - struct hv_device *Device) 166 + struct hv_device *device) 167 167 { 168 - struct storvsc_device *storDevice; 168 + struct storvsc_device *stor_device; 169 169 170 - storDevice = (struct storvsc_device *)Device->Extension; 171 - /* ASSERT(storDevice); */ 170 + stor_device = (struct storvsc_device *)device->Extension; 171 + /* ASSERT(stor_device); */ 172 172 173 173 /* Busy wait until the ref drop to 1, then set it to 0 */ 174 - while (atomic_cmpxchg(&storDevice->ref_count, 1, 0) != 1) 174 + while (atomic_cmpxchg(&stor_device->ref_count, 1, 0) != 1) 175 175 udelay(100); 176 176 177 - Device->Extension = NULL; 178 - return storDevice; 177 + device->Extension = NULL; 178 + return stor_device; 179 179 } 180 180 181 - static int stor_vsc_channel_init(struct hv_device *Device) 181 + static int stor_vsc_channel_init(struct hv_device *device) 182 182 { 183 - struct storvsc_device *storDevice; 183 + struct storvsc_device *stor_device; 184 184 struct storvsc_request_extension *request; 185 - struct vstor_packet *vstorPacket; 185 + struct vstor_packet *vstor_packet; 186 186 int ret; 187 187 188 - storDevice = get_stor_device(Device); 189 - if (!storDevice) { 188 + stor_device = get_stor_device(device); 189 + if (!stor_device) { 190 190 DPRINT_ERR(STORVSC, "unable to get stor device..." 191 191 "device being destroyed?"); 192 192 return -1; 193 193 } 194 194 195 - request = &storDevice->init_request; 196 - vstorPacket = &request->vstor_packet; 195 + request = &stor_device->init_request; 196 + vstor_packet = &request->vstor_packet; 197 197 198 198 /* 199 199 * Now, initiate the vsc/vsp initialization protocol on the open ··· 206 206 goto nomem; 207 207 } 208 208 209 - vstorPacket->operation = VSTOR_OPERATION_BEGIN_INITIALIZATION; 210 - vstorPacket->flags = REQUEST_COMPLETION_FLAG; 209 + vstor_packet->operation = VSTOR_OPERATION_BEGIN_INITIALIZATION; 210 + vstor_packet->flags = REQUEST_COMPLETION_FLAG; 211 211 212 212 /*SpinlockAcquire(gDriverExt.packetListLock); 213 213 INSERT_TAIL_LIST(&gDriverExt.packetList, &packet->listEntry.entry); ··· 215 215 216 216 DPRINT_INFO(STORVSC, "BEGIN_INITIALIZATION_OPERATION..."); 217 217 218 - ret = vmbus_sendpacket(Device->channel, vstorPacket, 218 + ret = vmbus_sendpacket(device->channel, vstor_packet, 219 219 sizeof(struct vstor_packet), 220 220 (unsigned long)request, 221 221 VmbusPacketTypeDataInBand, ··· 228 228 229 229 osd_waitevent_wait(request->wait_event); 230 230 231 - if (vstorPacket->operation != VSTOR_OPERATION_COMPLETE_IO || 232 - vstorPacket->status != 0) { 231 + if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO || 232 + vstor_packet->status != 0) { 233 233 DPRINT_ERR(STORVSC, "BEGIN_INITIALIZATION_OPERATION failed " 234 234 "(op %d status 0x%x)", 235 - vstorPacket->operation, vstorPacket->status); 235 + vstor_packet->operation, vstor_packet->status); 236 236 goto Cleanup; 237 237 } 238 238 239 239 DPRINT_INFO(STORVSC, "QUERY_PROTOCOL_VERSION_OPERATION..."); 240 240 241 241 /* reuse the packet for version range supported */ 242 - memset(vstorPacket, 0, sizeof(struct vstor_packet)); 243 - vstorPacket->operation = VSTOR_OPERATION_QUERY_PROTOCOL_VERSION; 244 - vstorPacket->flags = REQUEST_COMPLETION_FLAG; 242 + memset(vstor_packet, 0, sizeof(struct vstor_packet)); 243 + vstor_packet->operation = VSTOR_OPERATION_QUERY_PROTOCOL_VERSION; 244 + vstor_packet->flags = REQUEST_COMPLETION_FLAG; 245 245 246 - vstorPacket->version.major_minor = VMSTOR_PROTOCOL_VERSION_CURRENT; 247 - FILL_VMSTOR_REVISION(vstorPacket->version.revision); 246 + vstor_packet->version.major_minor = VMSTOR_PROTOCOL_VERSION_CURRENT; 247 + FILL_VMSTOR_REVISION(vstor_packet->version.revision); 248 248 249 - ret = vmbus_sendpacket(Device->channel, vstorPacket, 249 + ret = vmbus_sendpacket(device->channel, vstor_packet, 250 250 sizeof(struct vstor_packet), 251 251 (unsigned long)request, 252 252 VmbusPacketTypeDataInBand, ··· 260 260 osd_waitevent_wait(request->wait_event); 261 261 262 262 /* TODO: Check returned version */ 263 - if (vstorPacket->operation != VSTOR_OPERATION_COMPLETE_IO || 264 - vstorPacket->status != 0) { 263 + if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO || 264 + vstor_packet->status != 0) { 265 265 DPRINT_ERR(STORVSC, "QUERY_PROTOCOL_VERSION_OPERATION failed " 266 266 "(op %d status 0x%x)", 267 - vstorPacket->operation, vstorPacket->status); 267 + vstor_packet->operation, vstor_packet->status); 268 268 goto Cleanup; 269 269 } 270 270 271 271 /* Query channel properties */ 272 272 DPRINT_INFO(STORVSC, "QUERY_PROPERTIES_OPERATION..."); 273 273 274 - memset(vstorPacket, 0, sizeof(struct vstor_packet)); 275 - vstorPacket->operation = VSTOR_OPERATION_QUERY_PROPERTIES; 276 - vstorPacket->flags = REQUEST_COMPLETION_FLAG; 277 - vstorPacket->storage_channel_properties.port_number = 278 - storDevice->port_number; 274 + memset(vstor_packet, 0, sizeof(struct vstor_packet)); 275 + vstor_packet->operation = VSTOR_OPERATION_QUERY_PROPERTIES; 276 + vstor_packet->flags = REQUEST_COMPLETION_FLAG; 277 + vstor_packet->storage_channel_properties.port_number = 278 + stor_device->port_number; 279 279 280 - ret = vmbus_sendpacket(Device->channel, vstorPacket, 280 + ret = vmbus_sendpacket(device->channel, vstor_packet, 281 281 sizeof(struct vstor_packet), 282 282 (unsigned long)request, 283 283 VmbusPacketTypeDataInBand, ··· 292 292 osd_waitevent_wait(request->wait_event); 293 293 294 294 /* TODO: Check returned version */ 295 - if (vstorPacket->operation != VSTOR_OPERATION_COMPLETE_IO || 296 - vstorPacket->status != 0) { 295 + if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO || 296 + vstor_packet->status != 0) { 297 297 DPRINT_ERR(STORVSC, "QUERY_PROPERTIES_OPERATION failed " 298 298 "(op %d status 0x%x)", 299 - vstorPacket->operation, vstorPacket->status); 299 + vstor_packet->operation, vstor_packet->status); 300 300 goto Cleanup; 301 301 } 302 302 303 - storDevice->path_id = vstorPacket->storage_channel_properties.path_id; 304 - storDevice->target_id 305 - = vstorPacket->storage_channel_properties.target_id; 303 + stor_device->path_id = vstor_packet->storage_channel_properties.path_id; 304 + stor_device->target_id 305 + = vstor_packet->storage_channel_properties.target_id; 306 306 307 307 DPRINT_DBG(STORVSC, "channel flag 0x%x, max xfer len 0x%x", 308 - vstorPacket->storage_channel_properties.flags, 309 - vstorPacket->storage_channel_properties.max_transfer_bytes); 308 + vstor_packet->storage_channel_properties.flags, 309 + vstor_packet->storage_channel_properties.max_transfer_bytes); 310 310 311 311 DPRINT_INFO(STORVSC, "END_INITIALIZATION_OPERATION..."); 312 312 313 - memset(vstorPacket, 0, sizeof(struct vstor_packet)); 314 - vstorPacket->operation = VSTOR_OPERATION_END_INITIALIZATION; 315 - vstorPacket->flags = REQUEST_COMPLETION_FLAG; 313 + memset(vstor_packet, 0, sizeof(struct vstor_packet)); 314 + vstor_packet->operation = VSTOR_OPERATION_END_INITIALIZATION; 315 + vstor_packet->flags = REQUEST_COMPLETION_FLAG; 316 316 317 - ret = vmbus_sendpacket(Device->channel, vstorPacket, 317 + ret = vmbus_sendpacket(device->channel, vstor_packet, 318 318 sizeof(struct vstor_packet), 319 319 (unsigned long)request, 320 320 VmbusPacketTypeDataInBand, ··· 328 328 329 329 osd_waitevent_wait(request->wait_event); 330 330 331 - if (vstorPacket->operation != VSTOR_OPERATION_COMPLETE_IO || 332 - vstorPacket->status != 0) { 331 + if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO || 332 + vstor_packet->status != 0) { 333 333 DPRINT_ERR(STORVSC, "END_INITIALIZATION_OPERATION failed " 334 334 "(op %d status 0x%x)", 335 - vstorPacket->operation, vstorPacket->status); 335 + vstor_packet->operation, vstor_packet->status); 336 336 goto Cleanup; 337 337 } 338 338 ··· 342 342 kfree(request->wait_event); 343 343 request->wait_event = NULL; 344 344 nomem: 345 - put_stor_device(Device); 345 + put_stor_device(device); 346 346 return ret; 347 347 } 348 348 349 - static void stor_vsc_on_io_completion(struct hv_device *Device, 350 - struct vstor_packet *VStorPacket, 351 - struct storvsc_request_extension *RequestExt) 349 + static void stor_vsc_on_io_completion(struct hv_device *device, 350 + struct vstor_packet *vstor_packet, 351 + struct storvsc_request_extension *request_ext) 352 352 { 353 353 struct hv_storvsc_request *request; 354 - struct storvsc_device *storDevice; 354 + struct storvsc_device *stor_device; 355 355 356 - storDevice = must_get_stor_device(Device); 357 - if (!storDevice) { 356 + stor_device = must_get_stor_device(device); 357 + if (!stor_device) { 358 358 DPRINT_ERR(STORVSC, "unable to get stor device..." 359 359 "device being destroyed?"); 360 360 return; 361 361 } 362 362 363 363 DPRINT_DBG(STORVSC, "IO_COMPLETE_OPERATION - request extension %p " 364 - "completed bytes xfer %u", RequestExt, 365 - VStorPacket->vm_srb.data_transfer_length); 364 + "completed bytes xfer %u", request_ext, 365 + vstor_packet->vm_srb.data_transfer_length); 366 366 367 - /* ASSERT(RequestExt != NULL); */ 368 - /* ASSERT(RequestExt->Request != NULL); */ 367 + /* ASSERT(request_ext != NULL); */ 368 + /* ASSERT(request_ext->request != NULL); */ 369 369 370 - request = RequestExt->request; 370 + request = request_ext->request; 371 371 372 372 /* ASSERT(request->OnIOCompletion != NULL); */ 373 373 374 374 /* Copy over the status...etc */ 375 - request->status = VStorPacket->vm_srb.scsi_status; 375 + request->status = vstor_packet->vm_srb.scsi_status; 376 376 377 - if (request->status != 0 || VStorPacket->vm_srb.srb_status != 1) { 377 + if (request->status != 0 || vstor_packet->vm_srb.srb_status != 1) { 378 378 DPRINT_WARN(STORVSC, 379 379 "cmd 0x%x scsi status 0x%x srb status 0x%x\n", 380 - request->cdb[0], VStorPacket->vm_srb.scsi_status, 381 - VStorPacket->vm_srb.srb_status); 380 + request->cdb[0], vstor_packet->vm_srb.scsi_status, 381 + vstor_packet->vm_srb.srb_status); 382 382 } 383 383 384 384 if ((request->status & 0xFF) == 0x02) { 385 385 /* CHECK_CONDITION */ 386 - if (VStorPacket->vm_srb.srb_status & 0x80) { 386 + if (vstor_packet->vm_srb.srb_status & 0x80) { 387 387 /* autosense data available */ 388 388 DPRINT_WARN(STORVSC, "storvsc pkt %p autosense data " 389 - "valid - len %d\n", RequestExt, 390 - VStorPacket->vm_srb.sense_info_length); 389 + "valid - len %d\n", request_ext, 390 + vstor_packet->vm_srb.sense_info_length); 391 391 392 - /* ASSERT(VStorPacket->vm_srb.sense_info_length <= */ 392 + /* ASSERT(vstor_packet->vm_srb.sense_info_length <= */ 393 393 /* request->SenseBufferSize); */ 394 394 memcpy(request->sense_buffer, 395 - VStorPacket->vm_srb.sense_data, 396 - VStorPacket->vm_srb.sense_info_length); 395 + vstor_packet->vm_srb.sense_data, 396 + vstor_packet->vm_srb.sense_info_length); 397 397 398 398 request->sense_buffer_size = 399 - VStorPacket->vm_srb.sense_info_length; 399 + vstor_packet->vm_srb.sense_info_length; 400 400 } 401 401 } 402 402 403 403 /* TODO: */ 404 - request->bytes_xfer = VStorPacket->vm_srb.data_transfer_length; 404 + request->bytes_xfer = vstor_packet->vm_srb.data_transfer_length; 405 405 406 406 request->on_io_completion(request); 407 407 408 - atomic_dec(&storDevice->num_outstanding_requests); 408 + atomic_dec(&stor_device->num_outstanding_req); 409 409 410 - put_stor_device(Device); 410 + put_stor_device(device); 411 411 } 412 412 413 - static void stor_vsc_on_receive(struct hv_device *Device, 414 - struct vstor_packet *VStorPacket, 415 - struct storvsc_request_extension *RequestExt) 413 + static void stor_vsc_on_receive(struct hv_device *device, 414 + struct vstor_packet *vstor_packet, 415 + struct storvsc_request_extension *request_ext) 416 416 { 417 - switch (VStorPacket->operation) { 417 + switch (vstor_packet->operation) { 418 418 case VSTOR_OPERATION_COMPLETE_IO: 419 419 DPRINT_DBG(STORVSC, "IO_COMPLETE_OPERATION"); 420 - stor_vsc_on_io_completion(Device, VStorPacket, RequestExt); 420 + stor_vsc_on_io_completion(device, vstor_packet, request_ext); 421 421 break; 422 422 case VSTOR_OPERATION_REMOVE_DEVICE: 423 423 DPRINT_INFO(STORVSC, "REMOVE_DEVICE_OPERATION"); ··· 426 426 427 427 default: 428 428 DPRINT_INFO(STORVSC, "Unknown operation received - %d", 429 - VStorPacket->operation); 429 + vstor_packet->operation); 430 430 break; 431 431 } 432 432 } ··· 434 434 static void stor_vsc_on_channel_callback(void *context) 435 435 { 436 436 struct hv_device *device = (struct hv_device *)context; 437 - struct storvsc_device *storDevice; 438 - u32 bytesRecvd; 439 - u64 requestId; 437 + struct storvsc_device *stor_device; 438 + u32 bytes_recvd; 439 + u64 request_id; 440 440 unsigned char packet[ALIGN_UP(sizeof(struct vstor_packet), 8)]; 441 441 struct storvsc_request_extension *request; 442 442 int ret; 443 443 444 444 /* ASSERT(device); */ 445 445 446 - storDevice = must_get_stor_device(device); 447 - if (!storDevice) { 446 + stor_device = must_get_stor_device(device); 447 + if (!stor_device) { 448 448 DPRINT_ERR(STORVSC, "unable to get stor device..." 449 449 "device being destroyed?"); 450 450 return; ··· 453 453 do { 454 454 ret = vmbus_recvpacket(device->channel, packet, 455 455 ALIGN_UP(sizeof(struct vstor_packet), 8), 456 - &bytesRecvd, &requestId); 457 - if (ret == 0 && bytesRecvd > 0) { 456 + &bytes_recvd, &request_id); 457 + if (ret == 0 && bytes_recvd > 0) { 458 458 DPRINT_DBG(STORVSC, "receive %d bytes - tid %llx", 459 - bytesRecvd, requestId); 459 + bytes_recvd, request_id); 460 460 461 - /* ASSERT(bytesRecvd == sizeof(struct vstor_packet)); */ 461 + /* ASSERT(bytes_recvd == 462 + sizeof(struct vstor_packet)); */ 462 463 463 464 request = (struct storvsc_request_extension *) 464 - (unsigned long)requestId; 465 + (unsigned long)request_id; 465 466 /* ASSERT(request);c */ 466 467 467 - /* if (vstorPacket.Flags & SYNTHETIC_FLAG) */ 468 - if ((request == &storDevice->init_request) || 469 - (request == &storDevice->reset_request)) { 468 + /* if (vstor_packet.Flags & SYNTHETIC_FLAG) */ 469 + if ((request == &stor_device->init_request) || 470 + (request == &stor_device->reset_request)) { 470 471 /* DPRINT_INFO(STORVSC, 471 472 * "reset completion - operation " 472 473 * "%u status %u", 473 - * vstorPacket.Operation, 474 - * vstorPacket.Status); */ 474 + * vstor_packet.Operation, 475 + * vstor_packet.Status); */ 475 476 476 477 memcpy(&request->vstor_packet, packet, 477 478 sizeof(struct vstor_packet)); ··· 493 492 return; 494 493 } 495 494 496 - static int stor_vsc_connect_to_vsp(struct hv_device *Device) 495 + static int stor_vsc_connect_to_vsp(struct hv_device *device) 497 496 { 498 497 struct vmstorage_channel_properties props; 499 - struct storvsc_driver_object *storDriver; 498 + struct storvsc_driver_object *stor_driver; 500 499 int ret; 501 500 502 - storDriver = (struct storvsc_driver_object *)Device->Driver; 501 + stor_driver = (struct storvsc_driver_object *)device->Driver; 503 502 memset(&props, 0, sizeof(struct vmstorage_channel_properties)); 504 503 505 504 /* Open the channel */ 506 - ret = vmbus_open(Device->channel, 507 - storDriver->ring_buffer_size, 508 - storDriver->ring_buffer_size, 505 + ret = vmbus_open(device->channel, 506 + stor_driver->ring_buffer_size, 507 + stor_driver->ring_buffer_size, 509 508 (void *)&props, 510 509 sizeof(struct vmstorage_channel_properties), 511 - stor_vsc_on_channel_callback, Device); 510 + stor_vsc_on_channel_callback, device); 512 511 513 512 DPRINT_DBG(STORVSC, "storage props: path id %d, tgt id %d, max xfer %d", 514 513 props.path_id, props.target_id, props.max_transfer_bytes); ··· 518 517 return -1; 519 518 } 520 519 521 - ret = stor_vsc_channel_init(Device); 520 + ret = stor_vsc_channel_init(device); 522 521 523 522 return ret; 524 523 } ··· 527 526 * stor_vsc_on_device_add - Callback when the device belonging to this driver 528 527 * is added 529 528 */ 530 - static int stor_vsc_on_device_add(struct hv_device *Device, 531 - void *AdditionalInfo) 529 + static int stor_vsc_on_device_add(struct hv_device *device, 530 + void *additional_info) 532 531 { 533 - struct storvsc_device *storDevice; 532 + struct storvsc_device *stor_device; 534 533 /* struct vmstorage_channel_properties *props; */ 535 - struct storvsc_device_info *deviceInfo; 534 + struct storvsc_device_info *device_info; 536 535 int ret = 0; 537 536 538 - deviceInfo = (struct storvsc_device_info *)AdditionalInfo; 539 - storDevice = alloc_stor_device(Device); 540 - if (!storDevice) { 537 + device_info = (struct storvsc_device_info *)additional_info; 538 + stor_device = alloc_stor_device(device); 539 + if (!stor_device) { 541 540 ret = -1; 542 541 goto Cleanup; 543 542 } ··· 557 556 storChannel->PathId = props->PathId; 558 557 storChannel->TargetId = props->TargetId; */ 559 558 560 - storDevice->port_number = deviceInfo->port_number; 559 + stor_device->port_number = device_info->port_number; 561 560 /* Send it back up */ 562 - ret = stor_vsc_connect_to_vsp(Device); 561 + ret = stor_vsc_connect_to_vsp(device); 563 562 564 - /* deviceInfo->PortNumber = storDevice->PortNumber; */ 565 - deviceInfo->path_id = storDevice->path_id; 566 - deviceInfo->target_id = storDevice->target_id; 563 + /* device_info->PortNumber = stor_device->PortNumber; */ 564 + device_info->path_id = stor_device->path_id; 565 + device_info->target_id = stor_device->target_id; 567 566 568 567 DPRINT_DBG(STORVSC, "assigned port %u, path %u target %u\n", 569 - storDevice->port_number, storDevice->path_id, 570 - storDevice->target_id); 568 + stor_device->port_number, stor_device->path_id, 569 + stor_device->target_id); 571 570 572 571 Cleanup: 573 572 return ret; ··· 576 575 /* 577 576 * stor_vsc_on_device_remove - Callback when the our device is being removed 578 577 */ 579 - static int stor_vsc_on_device_remove(struct hv_device *Device) 578 + static int stor_vsc_on_device_remove(struct hv_device *device) 580 579 { 581 - struct storvsc_device *storDevice; 580 + struct storvsc_device *stor_device; 582 581 583 582 DPRINT_INFO(STORVSC, "disabling storage device (%p)...", 584 - Device->Extension); 583 + device->Extension); 585 584 586 - storDevice = release_stor_device(Device); 585 + stor_device = release_stor_device(device); 587 586 588 587 /* 589 588 * At this point, all outbound traffic should be disable. We 590 589 * only allow inbound traffic (responses) to proceed so that 591 590 * outstanding requests can be completed. 592 591 */ 593 - while (atomic_read(&storDevice->num_outstanding_requests)) { 592 + while (atomic_read(&stor_device->num_outstanding_req)) { 594 593 DPRINT_INFO(STORVSC, "waiting for %d requests to complete...", 595 - atomic_read(&storDevice->num_outstanding_requests)); 594 + atomic_read(&stor_device->num_outstanding_req)); 596 595 udelay(100); 597 596 } 598 597 599 598 DPRINT_INFO(STORVSC, "removing storage device (%p)...", 600 - Device->Extension); 599 + device->Extension); 601 600 602 - storDevice = final_release_stor_device(Device); 601 + stor_device = final_release_stor_device(device); 603 602 604 - DPRINT_INFO(STORVSC, "storage device (%p) safe to remove", storDevice); 603 + DPRINT_INFO(STORVSC, "storage device (%p) safe to remove", stor_device); 605 604 606 605 /* Close the channel */ 607 - vmbus_close(Device->channel); 606 + vmbus_close(device->channel); 608 607 609 - free_stor_device(storDevice); 608 + free_stor_device(stor_device); 610 609 return 0; 611 610 } 612 611 613 - int stor_vsc_on_host_reset(struct hv_device *Device) 612 + int stor_vsc_on_host_reset(struct hv_device *device) 614 613 { 615 - struct storvsc_device *storDevice; 614 + struct storvsc_device *stor_device; 616 615 struct storvsc_request_extension *request; 617 - struct vstor_packet *vstorPacket; 616 + struct vstor_packet *vstor_packet; 618 617 int ret; 619 618 620 619 DPRINT_INFO(STORVSC, "resetting host adapter..."); 621 620 622 - storDevice = get_stor_device(Device); 623 - if (!storDevice) { 621 + stor_device = get_stor_device(device); 622 + if (!stor_device) { 624 623 DPRINT_ERR(STORVSC, "unable to get stor device..." 625 624 "device being destroyed?"); 626 625 return -1; 627 626 } 628 627 629 - request = &storDevice->reset_request; 630 - vstorPacket = &request->vstor_packet; 628 + request = &stor_device->reset_request; 629 + vstor_packet = &request->vstor_packet; 631 630 632 631 request->wait_event = osd_waitevent_create(); 633 632 if (!request->wait_event) { ··· 635 634 goto Cleanup; 636 635 } 637 636 638 - vstorPacket->operation = VSTOR_OPERATION_RESET_BUS; 639 - vstorPacket->flags = REQUEST_COMPLETION_FLAG; 640 - vstorPacket->vm_srb.path_id = storDevice->path_id; 637 + vstor_packet->operation = VSTOR_OPERATION_RESET_BUS; 638 + vstor_packet->flags = REQUEST_COMPLETION_FLAG; 639 + vstor_packet->vm_srb.path_id = stor_device->path_id; 641 640 642 - ret = vmbus_sendpacket(Device->channel, vstorPacket, 641 + ret = vmbus_sendpacket(device->channel, vstor_packet, 643 642 sizeof(struct vstor_packet), 644 - (unsigned long)&storDevice->reset_request, 643 + (unsigned long)&stor_device->reset_request, 645 644 VmbusPacketTypeDataInBand, 646 645 VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); 647 646 if (ret != 0) { 648 647 DPRINT_ERR(STORVSC, "Unable to send reset packet %p ret %d", 649 - vstorPacket, ret); 648 + vstor_packet, ret); 650 649 goto Cleanup; 651 650 } 652 651 ··· 662 661 */ 663 662 664 663 Cleanup: 665 - put_stor_device(Device); 664 + put_stor_device(device); 666 665 return ret; 667 666 } 668 667 669 668 /* 670 669 * stor_vsc_on_io_request - Callback to initiate an I/O request 671 670 */ 672 - static int stor_vsc_on_io_request(struct hv_device *Device, 673 - struct hv_storvsc_request *Request) 671 + static int stor_vsc_on_io_request(struct hv_device *device, 672 + struct hv_storvsc_request *request) 674 673 { 675 - struct storvsc_device *storDevice; 676 - struct storvsc_request_extension *requestExtension; 677 - struct vstor_packet *vstorPacket; 674 + struct storvsc_device *stor_device; 675 + struct storvsc_request_extension *request_extension; 676 + struct vstor_packet *vstor_packet; 678 677 int ret = 0; 679 678 680 - requestExtension = 681 - (struct storvsc_request_extension *)Request->extension; 682 - vstorPacket = &requestExtension->vstor_packet; 683 - storDevice = get_stor_device(Device); 679 + request_extension = 680 + (struct storvsc_request_extension *)request->extension; 681 + vstor_packet = &request_extension->vstor_packet; 682 + stor_device = get_stor_device(device); 684 683 685 684 DPRINT_DBG(STORVSC, "enter - Device %p, DeviceExt %p, Request %p, " 686 - "Extension %p", Device, storDevice, Request, 687 - requestExtension); 685 + "Extension %p", device, stor_device, request, 686 + request_extension); 688 687 689 688 DPRINT_DBG(STORVSC, "req %p len %d bus %d, target %d, lun %d cdblen %d", 690 - Request, Request->data_buffer.Length, Request->bus, 691 - Request->target_id, Request->lun_id, Request->cdb_len); 689 + request, request->data_buffer.Length, request->bus, 690 + request->target_id, request->lun_id, request->cdb_len); 692 691 693 - if (!storDevice) { 692 + if (!stor_device) { 694 693 DPRINT_ERR(STORVSC, "unable to get stor device..." 695 694 "device being destroyed?"); 696 695 return -2; 697 696 } 698 697 699 - /* print_hex_dump_bytes("", DUMP_PREFIX_NONE, Request->Cdb, 700 - * Request->CdbLen); */ 698 + /* print_hex_dump_bytes("", DUMP_PREFIX_NONE, request->Cdb, 699 + * request->CdbLen); */ 701 700 702 - requestExtension->request = Request; 703 - requestExtension->device = Device; 701 + request_extension->request = request; 702 + request_extension->device = device; 704 703 705 - memset(vstorPacket, 0 , sizeof(struct vstor_packet)); 704 + memset(vstor_packet, 0 , sizeof(struct vstor_packet)); 706 705 707 - vstorPacket->flags |= REQUEST_COMPLETION_FLAG; 706 + vstor_packet->flags |= REQUEST_COMPLETION_FLAG; 708 707 709 - vstorPacket->vm_srb.length = sizeof(struct vmscsi_request); 708 + vstor_packet->vm_srb.length = sizeof(struct vmscsi_request); 710 709 711 - vstorPacket->vm_srb.port_number = Request->host; 712 - vstorPacket->vm_srb.path_id = Request->bus; 713 - vstorPacket->vm_srb.target_id = Request->target_id; 714 - vstorPacket->vm_srb.lun = Request->lun_id; 710 + vstor_packet->vm_srb.port_number = request->host; 711 + vstor_packet->vm_srb.path_id = request->bus; 712 + vstor_packet->vm_srb.target_id = request->target_id; 713 + vstor_packet->vm_srb.lun = request->lun_id; 715 714 716 - vstorPacket->vm_srb.sense_info_length = SENSE_BUFFER_SIZE; 715 + vstor_packet->vm_srb.sense_info_length = SENSE_BUFFER_SIZE; 717 716 718 717 /* Copy over the scsi command descriptor block */ 719 - vstorPacket->vm_srb.cdb_length = Request->cdb_len; 720 - memcpy(&vstorPacket->vm_srb.cdb, Request->cdb, Request->cdb_len); 718 + vstor_packet->vm_srb.cdb_length = request->cdb_len; 719 + memcpy(&vstor_packet->vm_srb.cdb, request->cdb, request->cdb_len); 721 720 722 - vstorPacket->vm_srb.data_in = Request->type; 723 - vstorPacket->vm_srb.data_transfer_length = Request->data_buffer.Length; 721 + vstor_packet->vm_srb.data_in = request->type; 722 + vstor_packet->vm_srb.data_transfer_length = request->data_buffer.Length; 724 723 725 - vstorPacket->operation = VSTOR_OPERATION_EXECUTE_SRB; 724 + vstor_packet->operation = VSTOR_OPERATION_EXECUTE_SRB; 726 725 727 726 DPRINT_DBG(STORVSC, "srb - len %d port %d, path %d, target %d, " 728 727 "lun %d senselen %d cdblen %d", 729 - vstorPacket->vm_srb.length, 730 - vstorPacket->vm_srb.port_number, 731 - vstorPacket->vm_srb.path_id, 732 - vstorPacket->vm_srb.target_id, 733 - vstorPacket->vm_srb.lun, 734 - vstorPacket->vm_srb.sense_info_length, 735 - vstorPacket->vm_srb.cdb_length); 728 + vstor_packet->vm_srb.length, 729 + vstor_packet->vm_srb.port_number, 730 + vstor_packet->vm_srb.path_id, 731 + vstor_packet->vm_srb.target_id, 732 + vstor_packet->vm_srb.lun, 733 + vstor_packet->vm_srb.sense_info_length, 734 + vstor_packet->vm_srb.cdb_length); 736 735 737 - if (requestExtension->request->data_buffer.Length) { 738 - ret = vmbus_sendpacket_multipagebuffer(Device->channel, 739 - &requestExtension->request->data_buffer, 740 - vstorPacket, 736 + if (request_extension->request->data_buffer.Length) { 737 + ret = vmbus_sendpacket_multipagebuffer(device->channel, 738 + &request_extension->request->data_buffer, 739 + vstor_packet, 741 740 sizeof(struct vstor_packet), 742 - (unsigned long)requestExtension); 741 + (unsigned long)request_extension); 743 742 } else { 744 - ret = vmbus_sendpacket(Device->channel, vstorPacket, 743 + ret = vmbus_sendpacket(device->channel, vstor_packet, 745 744 sizeof(struct vstor_packet), 746 - (unsigned long)requestExtension, 745 + (unsigned long)request_extension, 747 746 VmbusPacketTypeDataInBand, 748 747 VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); 749 748 } 750 749 751 750 if (ret != 0) { 752 751 DPRINT_DBG(STORVSC, "Unable to send packet %p ret %d", 753 - vstorPacket, ret); 752 + vstor_packet, ret); 754 753 } 755 754 756 - atomic_inc(&storDevice->num_outstanding_requests); 755 + atomic_inc(&stor_device->num_outstanding_req); 757 756 758 - put_stor_device(Device); 757 + put_stor_device(device); 759 758 return ret; 760 759 } 761 760 762 761 /* 763 762 * stor_vsc_on_cleanup - Perform any cleanup when the driver is removed 764 763 */ 765 - static void stor_vsc_on_cleanup(struct hv_driver *Driver) 764 + static void stor_vsc_on_cleanup(struct hv_driver *driver) 766 765 { 767 766 } 768 767 769 768 /* 770 769 * stor_vsc_initialize - Main entry point 771 770 */ 772 - int stor_vsc_initialize(struct hv_driver *Driver) 771 + int stor_vsc_initialize(struct hv_driver *driver) 773 772 { 774 - struct storvsc_driver_object *storDriver; 773 + struct storvsc_driver_object *stor_driver; 775 774 776 - storDriver = (struct storvsc_driver_object *)Driver; 775 + stor_driver = (struct storvsc_driver_object *)driver; 777 776 778 777 DPRINT_DBG(STORVSC, "sizeof(STORVSC_REQUEST)=%zd " 779 778 "sizeof(struct storvsc_request_extension)=%zd " ··· 785 784 sizeof(struct vmscsi_request)); 786 785 787 786 /* Make sure we are at least 2 pages since 1 page is used for control */ 788 - /* ASSERT(storDriver->RingBufferSize >= (PAGE_SIZE << 1)); */ 787 + /* ASSERT(stor_driver->RingBufferSize >= (PAGE_SIZE << 1)); */ 789 788 790 - Driver->name = g_driver_name; 791 - memcpy(&Driver->deviceType, &gStorVscDeviceType, 789 + driver->name = g_driver_name; 790 + memcpy(&driver->deviceType, &gStorVscDeviceType, 792 791 sizeof(struct hv_guid)); 793 792 794 - storDriver->request_ext_size = sizeof(struct storvsc_request_extension); 793 + stor_driver->request_ext_size = 794 + sizeof(struct storvsc_request_extension); 795 795 796 796 /* 797 797 * Divide the ring buffer data size (which is 1 page less ··· 800 798 * the ring buffer indices) by the max request size (which is 801 799 * vmbus_channel_packet_multipage_buffer + struct vstor_packet + u64) 802 800 */ 803 - storDriver->max_outstanding_req_per_channel = 804 - ((storDriver->ring_buffer_size - PAGE_SIZE) / 801 + stor_driver->max_outstanding_req_per_channel = 802 + ((stor_driver->ring_buffer_size - PAGE_SIZE) / 805 803 ALIGN_UP(MAX_MULTIPAGE_BUFFER_PACKET + 806 804 sizeof(struct vstor_packet) + sizeof(u64), 807 805 sizeof(u64))); 808 806 809 807 DPRINT_INFO(STORVSC, "max io %u, currently %u\n", 810 - storDriver->max_outstanding_req_per_channel, 808 + stor_driver->max_outstanding_req_per_channel, 811 809 STORVSC_MAX_IO_REQUESTS); 812 810 813 811 /* Setup the dispatch table */ 814 - storDriver->base.OnDeviceAdd = stor_vsc_on_device_add; 815 - storDriver->base.OnDeviceRemove = stor_vsc_on_device_remove; 816 - storDriver->base.OnCleanup = stor_vsc_on_cleanup; 812 + stor_driver->base.OnDeviceAdd = stor_vsc_on_device_add; 813 + stor_driver->base.OnDeviceRemove = stor_vsc_on_device_remove; 814 + stor_driver->base.OnCleanup = stor_vsc_on_cleanup; 817 815 818 - storDriver->on_io_request = stor_vsc_on_io_request; 816 + stor_driver->on_io_request = stor_vsc_on_io_request; 819 817 820 818 return 0; 821 819 }