|  | @@ -277,7 +277,6 @@ static void disk_reset_state(struct ctl_state *state)
 | 
	
		
			
				|  |  |  static struct drive_state *
 | 
	
		
			
				|  |  |  name_to_drive(const char *drive)
 | 
	
		
			
				|  |  |  {
 | 
	
		
			
				|  |  | -    struct ctl_state *state;
 | 
	
		
			
				|  |  |      unsigned int ndrive;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /* All drive names are three letters long */
 | 
	
	
		
			
				|  | @@ -294,7 +293,7 @@ name_to_drive(const char *drive)
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      for (int i = 0; i < CONTROLLER_TYPES; i++) {
 | 
	
		
			
				|  |  | -	struct ctl_state *state = &controllers[i];
 | 
	
		
			
				|  |  | +	struct ctl_state * const state = &controllers[i];
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	if (!memcmp(state->params->name, drive, 2))
 | 
	
		
			
				|  |  |  	    return &state->drv[ndrive];
 | 
	
	
		
			
				|  | @@ -392,35 +391,25 @@ static void unmount_drives(struct ctl_state *state)
 | 
	
		
			
				|  |  |  /* RST# = global reset, C3# = local reset, C1# = goto command start */
 | 
	
		
			
				|  |  |  #define IDLE_CALLBACK_MASK	((1 << 7)|(1 << 4)|(1 << 2))
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -static ABC_CALLBACK(abcdisk_callback_out)
 | 
	
		
			
				|  |  | +static ABC_CALLBACK(abcdisk_callback_out_inp)
 | 
	
		
			
				|  |  |  {
 | 
	
		
			
				|  |  | -    struct ctl_state *state = container_of(dev, struct ctl_state, iodev);
 | 
	
		
			
				|  |  | +    struct ctl_state * const state = container_of(dev, struct ctl_state, iodev);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      dev->callback_mask = IDLE_CALLBACK_MASK;
 | 
	
		
			
				|  |  | -    ABC_INP1_DATA = dev->inp_data[1] = 0;
 | 
	
		
			
				|  |  | -    state->error = 0;
 | 
	
		
			
				|  |  | -    state->pending |= PEND_IO;
 | 
	
		
			
				|  |  | -}
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -static ABC_CALLBACK(abcdisk_callback_inp)
 | 
	
		
			
				|  |  | -{
 | 
	
		
			
				|  |  | -    struct ctl_state *state = container_of(dev, struct ctl_state, iodev);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    dev->callback_mask = IDLE_CALLBACK_MASK;
 | 
	
		
			
				|  |  | -    ABC_INP1_DATA = dev->inp_data[1] = 0;
 | 
	
		
			
				|  |  | +    __abc_set_inp_status(dev, 0);
 | 
	
		
			
				|  |  |      state->error = 0;
 | 
	
		
			
				|  |  |      state->pending |= PEND_IO;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  static ABC_CALLBACK(abcdisk_callback_restart)
 | 
	
		
			
				|  |  |  {
 | 
	
		
			
				|  |  | -    struct ctl_state *state = container_of(dev, struct ctl_state, iodev);
 | 
	
		
			
				|  |  | +    struct ctl_state * const state = container_of(dev, struct ctl_state, iodev);
 | 
	
		
			
				|  |  |      state->pending |= PEND_STARTCMD;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  static ABC_CALLBACK(abcdisk_callback_rst)
 | 
	
		
			
				|  |  |  {
 | 
	
		
			
				|  |  | -    struct ctl_state *state = container_of(dev, struct ctl_state, iodev);
 | 
	
		
			
				|  |  | +    struct ctl_state * const state = container_of(dev, struct ctl_state, iodev);
 | 
	
		
			
				|  |  |      state->pending |= PEND_RESET;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -465,7 +454,7 @@ static void init_drives(struct ctl_state *state)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  static void do_next_command(struct ctl_state *state)
 | 
	
		
			
				|  |  |  {
 | 
	
		
			
				|  |  | -    struct drive_state *drv = cur_drv_mutable(state);
 | 
	
		
			
				|  |  | +    struct drive_state * const drv = cur_drv_mutable(state);
 | 
	
		
			
				|  |  |      uint8_t *buf = cur_buf(state);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  #if 0
 | 
	
	
		
			
				|  | @@ -734,7 +723,7 @@ void __hot abcdisk_io_poll(void)
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      for (int i = 0; i < CONTROLLER_TYPES; i++) {
 | 
	
		
			
				|  |  | -	struct ctl_state *state = &controllers[i];
 | 
	
		
			
				|  |  | +	struct ctl_state * const state = &controllers[i];
 | 
	
		
			
				|  |  |  	enum pending pending = 0;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	if (unmount_all && state->initialized) {
 | 
	
	
		
			
				|  | @@ -780,15 +769,15 @@ void abcdisk_init(void)
 | 
	
		
			
				|  |  |  	.inp_en = 3,
 | 
	
		
			
				|  |  |  	.status_first_out_mask = (uint8_t)~0x80,
 | 
	
		
			
				|  |  |  	.status_first_inp_mask = (uint8_t)~0x80,
 | 
	
		
			
				|  |  | -	.callback_out[0] = abcdisk_callback_out,
 | 
	
		
			
				|  |  | -	.callback_inp[0] = abcdisk_callback_inp,
 | 
	
		
			
				|  |  | +	.callback_out[0] = abcdisk_callback_out_inp,
 | 
	
		
			
				|  |  | +	.callback_inp[0] = abcdisk_callback_out_inp,
 | 
	
		
			
				|  |  |  	.callback_out[2] = abcdisk_callback_restart,
 | 
	
		
			
				|  |  |  	.callback_out[4] = abcdisk_callback_rst, /* C3# = local reset */
 | 
	
		
			
				|  |  |  	.callback_rst    = abcdisk_callback_rst
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      for (int i = 0; i < CONTROLLER_TYPES; i++) {
 | 
	
		
			
				|  |  | -	struct ctl_state *state = &controllers[i];
 | 
	
		
			
				|  |  | +	struct ctl_state * const state = &controllers[i];
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	state->params = ¶meters[i];
 | 
	
		
			
				|  |  |  	state->iodev  = iodev_template;
 |