Lines Matching refs:fwlp
62 struct fw_upload_priv *fwlp = to_fw_sysfs(dev)->fw_upload_priv; in status_show() local
64 return sysfs_emit(buf, "%s\n", fw_upload_progress(dev, fwlp->progress)); in status_show()
71 struct fw_upload_priv *fwlp = to_fw_sysfs(dev)->fw_upload_priv; in error_show() local
74 mutex_lock(&fwlp->lock); in error_show()
76 if (fwlp->progress != FW_UPLOAD_PROG_IDLE) in error_show()
78 else if (!fwlp->err_code) in error_show()
82 fw_upload_progress(dev, fwlp->err_progress), in error_show()
83 fw_upload_error(dev, fwlp->err_code)); in error_show()
85 mutex_unlock(&fwlp->lock); in error_show()
94 struct fw_upload_priv *fwlp = to_fw_sysfs(dev)->fw_upload_priv; in cancel_store() local
101 mutex_lock(&fwlp->lock); in cancel_store()
102 if (fwlp->progress == FW_UPLOAD_PROG_IDLE) in cancel_store()
105 fwlp->ops->cancel(fwlp->fw_upload); in cancel_store()
106 mutex_unlock(&fwlp->lock); in cancel_store()
115 struct fw_upload_priv *fwlp = to_fw_sysfs(dev)->fw_upload_priv; in remaining_size_show() local
117 return sysfs_emit(buf, "%u\n", fwlp->remaining_size); in remaining_size_show()
134 static void fw_upload_update_progress(struct fw_upload_priv *fwlp, in fw_upload_update_progress() argument
137 mutex_lock(&fwlp->lock); in fw_upload_update_progress()
138 fwlp->progress = new_progress; in fw_upload_update_progress()
139 mutex_unlock(&fwlp->lock); in fw_upload_update_progress()
142 static void fw_upload_set_error(struct fw_upload_priv *fwlp, in fw_upload_set_error() argument
145 mutex_lock(&fwlp->lock); in fw_upload_set_error()
146 fwlp->err_progress = fwlp->progress; in fw_upload_set_error()
147 fwlp->err_code = err_code; in fw_upload_set_error()
148 mutex_unlock(&fwlp->lock); in fw_upload_set_error()
151 static void fw_upload_prog_complete(struct fw_upload_priv *fwlp) in fw_upload_prog_complete() argument
153 mutex_lock(&fwlp->lock); in fw_upload_prog_complete()
154 fwlp->progress = FW_UPLOAD_PROG_IDLE; in fw_upload_prog_complete()
155 mutex_unlock(&fwlp->lock); in fw_upload_prog_complete()
160 struct fw_upload_priv *fwlp; in fw_upload_main() local
167 fwlp = container_of(work, struct fw_upload_priv, work); in fw_upload_main()
168 fwl = fwlp->fw_upload; in fw_upload_main()
172 fw_upload_update_progress(fwlp, FW_UPLOAD_PROG_PREPARING); in fw_upload_main()
173 ret = fwlp->ops->prepare(fwl, fwlp->data, fwlp->remaining_size); in fw_upload_main()
175 fw_upload_set_error(fwlp, ret); in fw_upload_main()
179 fw_upload_update_progress(fwlp, FW_UPLOAD_PROG_TRANSFERRING); in fw_upload_main()
180 while (fwlp->remaining_size) { in fw_upload_main()
181 ret = fwlp->ops->write(fwl, fwlp->data, offset, in fw_upload_main()
182 fwlp->remaining_size, &written); in fw_upload_main()
188 fw_upload_set_error(fwlp, ret); in fw_upload_main()
192 fwlp->remaining_size -= written; in fw_upload_main()
196 fw_upload_update_progress(fwlp, FW_UPLOAD_PROG_PROGRAMMING); in fw_upload_main()
197 ret = fwlp->ops->poll_complete(fwl); in fw_upload_main()
199 fw_upload_set_error(fwlp, ret); in fw_upload_main()
202 if (fwlp->ops->cleanup) in fw_upload_main()
203 fwlp->ops->cleanup(fwl); in fw_upload_main()
217 fwlp->data = NULL; in fw_upload_main()
218 fw_upload_prog_complete(fwlp); in fw_upload_main()
229 struct fw_upload_priv *fwlp; in fw_upload_start() local
240 fwlp = fw_sysfs->fw_upload_priv; in fw_upload_start()
241 mutex_lock(&fwlp->lock); in fw_upload_start()
244 if (fwlp->progress != FW_UPLOAD_PROG_IDLE) { in fw_upload_start()
245 mutex_unlock(&fwlp->lock); in fw_upload_start()
251 fwlp->progress = FW_UPLOAD_PROG_RECEIVING; in fw_upload_start()
252 fwlp->err_code = 0; in fw_upload_start()
253 fwlp->remaining_size = fw_priv->size; in fw_upload_start()
254 fwlp->data = fw_priv->data; in fw_upload_start()
261 queue_work(system_long_wq, &fwlp->work); in fw_upload_start()
262 mutex_unlock(&fwlp->lock); in fw_upload_start()